Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add supoort for enabling GPU access #920

Merged
merged 1 commit into from May 19, 2024
Merged

Conversation

mokeyish
Copy link
Contributor

closes #919

Copy link
Collaborator

@p12tic p12tic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks.

Could you add unit tests? There's a bunch already in pytests/test_container_to_args.py. It should be easy to extend the test suite for the GPU options. The existing tests test container_to_args() which I think is appropriate level of detail for the additional GPU tests.

@mokeyish
Copy link
Contributor Author

mokeyish commented May 6, 2024

@p12tic I looked at the existing unit tests and it was a bit difficult to understand. It seems to be output after execution. But Github Actions does not have a GPU and cannot be tested.

@p12tic
Copy link
Collaborator

p12tic commented May 6, 2024

@mokeyish Tests in pytests/test_container_to_args.py don't actually run any containers.

The test structure is as follows:

  • create compose definition in parsed form (i.e. python dicts, lists, etc. are used)
  • run it through container_to_args function
  • the result is arguments which would be otherwise sent to podman. The test simply compares them to what's expected and does not run podman.

With such tests any feature of podman-compose can be tested without any requirements from hardware.

@p12tic
Copy link
Collaborator

p12tic commented May 6, 2024

So in GPU tests I would expect tests that check whether correct GPU-related options are added to podman_args.

@@ -325,3 +325,106 @@ async def test_env_file_obj_optional(self):
"busybox",
],
)

async def test_gpu(self):
Copy link
Collaborator

@p12tic p12tic May 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test is actually 4 tests. Could it be split? It's ok if the preamble

        c = create_compose_mock()

        cnt = get_minimal_container()
        cnt["command"] = ["nvidia-smi"]
        cnt["deploy"] = {"resources": {"reservations": {"devices": [{}]}}}

repeats in each test.

@muayyad-alsadi muayyad-alsadi merged commit 23ad5c3 into containers:main May 19, 2024
8 checks passed
@p12tic p12tic mentioned this pull request May 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

FR: Enabling GPU access to service containers
3 participants