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 sample RQD Dockerfile with CUDA base image #1327

Merged
merged 7 commits into from
May 21, 2024

Conversation

n-jay
Copy link
Contributor

@n-jay n-jay commented Nov 7, 2023

Link the Issue(s) this Pull Request is related to.
Related to PR #1309.
As discussed in the mail thread Blender plugin development.

Summarize your change.
Adds a sample RQD Dockerfile with CUDA supported base image for GPU rendering.
Tested with new derived RQD Blender image.

Works in combination with Nvidia Container Toolkit.

@bcipriano
Copy link
Collaborator

General thought here -- the Dockerfile here seems to duplicate much of the standard RQD image, though I understand it's using a different base image.

It's possible to have a Dockerfile which selectively copies files from another image using COPY --from. I wonder if this CUDA Dockerfile could do that -- start with the CUDA base image, copy the RQD tarball from the base RQD image, then do anything else that's CUDA specific.

This would help keep this image in sync with the base RQD image. Otherwise we will make changes to the base RQD image and forget to update this one.

Could you give that a try?

@DiegoTavares
Copy link
Collaborator

I'm with Brian on the idea that it would be better if we could copy the rqd tarball from the base image

@n-jay
Copy link
Contributor Author

n-jay commented Nov 9, 2023

Noted @bcipriano @DiegoTavares, that's a lot more efficient.
Just to clarify, would this be the tarball generated in the /opt/opencue directory of the image?

...then do anything else that's CUDA specific.

Actually, there are no other changes done on the Dockerfile other than the inclusion of the base CUDA image.
Everything else is dependent on the Nvidia driver and Container Toolkit installation on the host machine beforehand.
But now that you mentioned it, I'll include the nvidia-smi command at end of this Dockerfile to verify correct installation of all CUDA components.

Additionally, should add some documentation about this but not quite sure where. Perhaps as an amendment to the Deploying RQD page?

@bcipriano
Copy link
Collaborator

Just to clarify, would this be the tarball generated in the /opt/opencue directory of the image?

Yeah, that's probably the best way as you'll just need to copy that single file, everything is self-contained. Will be stored as /opt/opencue/rqd-{version}-all.tar.gz I believe.

Once the file is copied you'll still need to do any steps needed to install and run RQD.

Additionally, should add some documentation about this but not quite sure where. Perhaps as an amendment to the Deploying RQD page?

Hmm, how about this -- we have Customizing RQD, you could add a section there called like "Sample Dockerfiles" which links to the samples/rqd/ directory in the repo.

You could also add the Customizing RQD page to the Deploying RQD "What's Next?" section. That seems like it would flow nicely.

@n-jay
Copy link
Contributor Author

n-jay commented Nov 21, 2023

@bcipriano, as suggested I implemented the COPY --from command for the tarball as well as RQD config file and the proto directory which were not included with the tarball extraction. Tested with CueBot and seems to be connecting and working as expected.

I'll include the nvidia-smi command at end of this Dockerfile

Turns out that the command only works when mounted to a GPU as in the docker run command, which seemed unnecessary just for this Dockerfile, and also doesn't seem to be possible.

we have Customizing RQD, you could add a section there called like "Sample Dockerfiles" which links to the samples/rqd/ directory in the repo. You could also add the Customizing RQD page to the Deploying RQD "What's Next?" section. That seems like it would flow nicely.

Noted. That sounds good, will get on it.

Also, a couple of things to clarify:

  1. Would there be a graceful way to resolve the version number used for the tarball name via a variable? Would help dynamically get it for use in the tarball filename.

    COPY --from=opencue/rqd /opt/opencue/rqd-0.22-custom-all.tar.gz /opt/opencue/rqd-0.22-custom-all.tar.gz

    I tried this out but seem to be having some trouble with my current test implementation extracting the value from the VERSION file and assigning it to an ARG or ENV variable.

    COPY --from=opencue/rqd /opt/opencue/VERSION /opt/opencue/VERSION
    ENV VERSION=""
    RUN cat /opt/opencue/VERSION > $VERSION
    
    COPY --from=opencue/rqd /opt/opencue/rqd-${VERSION}-custom-all.tar.gz /opt/opencue/rqd-${VERSION}-custom-all.tar.gz
    
  2. Are the gRPC related instructions like the one below required for the installation since I'm importing the proto directory also from the opencue/rqd image? If its redundant, will remove.

    RUN python3.6 -m grpc_tools.protoc \
    -I=./proto \
    --python_out=./rqd/compiled_proto \
    --grpc_python_out=./rqd/compiled_proto \
    ./proto/*.proto

@DiegoTavares
Copy link
Collaborator

@bcipriano, as suggested I implemented the COPY --from command for the tarball as well as RQD config file and the proto directory which were not included with the tarball extraction. Tested with CueBot and seems to be connecting and working as expected.

I'll include the nvidia-smi command at end of this Dockerfile

Turns out that the command only works when mounted to a GPU as in the docker run command, which seemed unnecessary just for this Dockerfile, and also doesn't seem to be possible.

we have Customizing RQD, you could add a section there called like "Sample Dockerfiles" which links to the samples/rqd/ directory in the repo. You could also add the Customizing RQD page to the Deploying RQD "What's Next?" section. That seems like it would flow nicely.

Noted. That sounds good, will get on it.

Also, a couple of things to clarify:

  1. Would there be a graceful way to resolve the version number used for the tarball name via a variable? Would help dynamically get it for use in the tarball filename.

    COPY --from=opencue/rqd /opt/opencue/rqd-0.22-custom-all.tar.gz /opt/opencue/rqd-0.22-custom-all.tar.gz

    I tried this out but seem to be having some trouble with my current test implementation extracting the value from the VERSION file and assigning it to an ARG or ENV variable.

    COPY --from=opencue/rqd /opt/opencue/VERSION /opt/opencue/VERSION
    ENV VERSION=""
    RUN cat /opt/opencue/VERSION > $VERSION
    
    COPY --from=opencue/rqd /opt/opencue/rqd-${VERSION}-custom-all.tar.gz /opt/opencue/rqd-${VERSION}-custom-all.tar.gz
    
  2. Are the gRPC related instructions like the one below required for the installation since I'm importing the proto directory also from the opencue/rqd image? If its redundant, will remove.

    RUN python3.6 -m grpc_tools.protoc \
    -I=./proto \
    --python_out=./rqd/compiled_proto \
    --grpc_python_out=./rqd/compiled_proto \
    ./proto/*.proto

Sorry for taking ages to reply to this:

  1. Unfortunately COPY runs on the build environment, so it doesn't have access to variables set by RUN. I don't see a simple solution here, maybe try copying with a regex:
COPY --from=opencue/rqd /opt/opencue/rqd-*-all.tar.gz /opt/opencue/
  1. If you're copying the tarball from the rqd image, you don't need to run the build steps.

@n-jay
Copy link
Contributor Author

n-jay commented Mar 8, 2024

No worries @DiegoTavares 😄. Took me a while to get back to this also.

Unfortunately COPY runs on the build environment, so it doesn't have access to variables set by RUN. I don't see a simple solution here, maybe try copying with a regex

Noted. This worked, thanks!
Resolved in 85dae74
However there seems to be a linting issue in an unrelated service.py wrapper.

@n-jay
Copy link
Contributor Author

n-jay commented Apr 14, 2024

Ping @DiegoTavares

@n-jay n-jay requested a review from ramonfigueiredo as a code owner May 14, 2024 17:58
Comment on lines +5 to +14
RUN yum -y install \
epel-release \
gcc \
python-devel \
time

RUN yum -y install \
python36 \
python36-devel \
python36-pip
Copy link
Collaborator

Choose a reason for hiding this comment

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

Use a single RUN command and add && yum clean all to reduce the size of the end image

@DiegoTavares DiegoTavares merged commit 3084958 into AcademySoftwareFoundation:master May 21, 2024
12 checks passed
carlosfelgarcia pushed a commit to carlosfelgarcia/OpenCue that referenced this pull request May 22, 2024
…tion#1327)

* Add sample RQD Dockerfile with CUDA base image

* Import release tarball from prebuilt RQD image

* Amend directory paths

For gRPC data and python scripts

* Resolve tarball version number
carlosfelgarcia pushed a commit to carlosfelgarcia/OpenCue that referenced this pull request May 22, 2024
…tion#1327)

* Add sample RQD Dockerfile with CUDA base image

* Import release tarball from prebuilt RQD image

* Amend directory paths

For gRPC data and python scripts

* Resolve tarball version number
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.

3 participants