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

CUDA compilation flags #74

Open
mclarsen opened this issue Aug 28, 2017 · 6 comments
Open

CUDA compilation flags #74

mclarsen opened this issue Aug 28, 2017 · 6 comments

Comments

@mclarsen
Copy link
Contributor

mclarsen commented Aug 28, 2017

Is there a special way to propagate defines? I am adding a library that depends on cuda, and nvcc is being invoked., but -D PARALLEL is not being passed to nvcc. Am I doing something incorrectly?

blt_add_library( NAME vtkh_par SOURCES ${vtkh_sources} ${vtkh_par_sources} HEADERS ${vtkh_par_headers} ${vtkh_headers} DEPENDS_ON ${vtkh_thirdparty_libs} mpi icet)

blt_add_target_compile_flags(TO vtkh_par FLAGS "-D PARALLEL")

@kennyweiss
Copy link
Member

blt_register_library has additional arguments to add flags and defines to a library target.

I am not entirely sure how blt_register_library works when the library is generated with blt_add_library through. @white238, can you please clarify?

@mclarsen
Copy link
Contributor Author

To be clear, this works correctly without cuda.

@cyrush
Copy link
Member

cyrush commented Aug 28, 2017

the issue is for CMake cuda targets (created via macros in FindCUDA), you can't add any additional flags after the targets are created.

The work around is to add the defines to global flags CMAKE_CXX_FLAGS before blt_add_library and then restore the old flags after

This is actually a compelling case for adding an optional DEFINES arg to blt_add_library

We can't use blt_register_library to solve this b/c these flags are needed to compile the lib. (And in this case the aren't needed by client code)

@cyrush
Copy link
Member

cyrush commented Aug 29, 2017

Update: setting CMAKE_CXX_FLAGS doesn't work w/ BLT's current cuda support. The only path I found was to add the defs to global CUDA_NVCC_FLAGS (along with keeping old and restoring them after adding the lib)

@mclarsen and I were able to modify CMAKE_CXX_FLAGS before, however we were using cuda_wrap_srcs, not cuda_add_library, which BLT is currently using

@mclarsen
Copy link
Contributor Author

mclarsen commented May 8, 2018

Bit by this again in another project.

@cyrush
Copy link
Member

cyrush commented May 15, 2018

FYI: @mclarsen There is work to pivot to CMake's native cuda support: #154

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

No branches or pull requests

3 participants