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

Make GPU Code optional #335

Merged
merged 8 commits into from
Sep 14, 2023
Merged

Make GPU Code optional #335

merged 8 commits into from
Sep 14, 2023

Conversation

jeremykubica
Copy link
Contributor

Changes the CMake and setup file to compile in CPU only mode in cases where there is no CUDA compiler or valid GPU. Adds #ifdef overrides to the C++ code to avoid GPU specific code in CPU-only mode.

However this currently only raises an error when we try to call a GPU function. We will need to replace the GPU code with CPU equivalents (where we want them) for tests to pass on non-CPU machines.

Copy link
Member

@DinoBektesevic DinoBektesevic left a comment

Choose a reason for hiding this comment

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

This breaks tests. We need to protect tests that execute on GPU from doing so then and also we need to rework the CI to test the new build path. Currently, for the sake of saving time we build the per-PR tests in a pre-made environment that is always set up with the GPU in path.

I'm approving this, under condition the build message not printing out is handled before merge, because testing no-GPU build path is not high priority at the moment.


target_link_libraries(search PRIVATE searchcu)
else()
message(STATUS "Skipping CUDA Libraries")
Copy link
Member

Choose a reason for hiding this comment

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

This never prints for me. From the manual it seems as it should. I think I remember reading that Python and C++ don't deal with their prints very nicely in the Pybind docs. Perhaps something similar could be the cause of the lost message. We could punt that out to setup.py - in which case we can basically be sure it would work.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If you build with pip install ., it doesn't show the output of either the cmake messages or python (setup.py). You can get them if you do the individual steps (such as running cmake).

@@ -10,6 +10,7 @@
#ifndef RAWIMAGE_H_
#define RAWIMAGE_H_

#include <algorithm>
Copy link
Member

Choose a reason for hiding this comment

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

I can't see anything in your changes to RawImage that calls something from this list: https://cplusplus.com/reference/algorithm/

Is this required?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The code uses std::sort below, which needs algorithm.

I saw this and the std::isnan problems in RawImage.cpp when I tried to build on a completely new platform.

@jeremykubica jeremykubica merged commit a8d76da into main Sep 14, 2023
1 check passed
@jeremykubica jeremykubica deleted the cuda_opt branch September 14, 2023 19:58
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.

2 participants