Re: [CMake] how do you allow CMAKE_CUDA_COMPILER to be optional via project LANGUAGE?

2018-08-28 Thread Quang Ha
It works perfectly - thanks! QT On Tue, 28 Aug 2018 at 12:37, Robert Maynard wrote: > The way Eric suggest with check_language is what I use when I want to > conditionally support CUDA. > > On Tue, Aug 28, 2018 at 10:28 AM Eric Noulard > wrote: > >> >> >>

[CMake] how do you allow CMAKE_CUDA_COMPILER to be optional via project LANGUAGE?

2018-08-28 Thread Quang Ha
Hi all, So this question is again about project(foo LANGUAGES CXX CUDA). Is it possible to switch off CUDA if Cmake couldn't find CUDA compiler? I.e. something along the line: if (CUDA_FOUND) set_language_to_CUDA_and_CXX else(CUDA_FOUND) set_language_to_CXX_only endif(CUDA_FOUND) The main

[CMake] CMake specify using either NVCC or host compilers with add_executable

2018-08-27 Thread Quang Ha
Hi all, With the new way CMake is treating CUDA codes, now we can do: project(foo LANGUAGES CXX CUDA) and can do: add_executable(foo_cuda foo.cu) # will use NVCC add_executable(foo_cpp foo.cpp) # will use host compilers Now since CUDA can take *.cpp files as extension (see

[CMake] set environment variables for ctest globally

2018-08-16 Thread Quang Ha
Hi all, In our ctest script, we used a cmake files generated from building third-party libraries, i.e.: cmake -C"/path/to/third-parties/share/cmake/amanzi-tpl-config.cmake" [other options] Is there a way to pass all those configurations (i.e. PATH/LD_LIBRARY_PATH/CPATH) into the ctest

[CMake] setting FIXTURES_* and RESOURCE_LOCK caused permission denied for dependent test?

2018-08-02 Thread Quang Ha
Hi all, I am facing the issue of FIXTURES for setting up dependent test. Using RESOURCE_LOCK. Currently, it looks something like this: === set_test_properties(run_simulation PROPERTIES FIXTURES_SETUP ${simulation_name})

[CMake] ctest to output files

2018-07-31 Thread Quang Ha
Hi all, Is there a way to let ctest create an output file after a certain test? Say I want to run test 1 (name "run_simulation"), which is a simulation and should produce an output file containing numerical results. I then want to compare it against analytical results in test 2 (name

Re: [CMake] CMake for CUDA with MPICC still using gcc to link?

2018-07-31 Thread Quang Ha
need a clean > build directory for this to work). > On Tue, Jul 31, 2018 at 1:43 PM Quang Ha wrote: > > > > Hi all, > > > > Currently using cmake/3.11.1, I want to try and compile MPI/CUDA > application with cmake. I kept running into problems of 'undefined > MPI_Init', so I

[CMake] CMake for CUDA with MPICC still using gcc to link?

2018-07-31 Thread Quang Ha
Hi all, Currently using cmake/3.11.1, I want to try and compile MPI/CUDA application with cmake. I kept running into problems of 'undefined MPI_Init', so I take a look at `make VERBOSE=1`. The output looks something like this

Re: [CMake] CMAKE doesn't pass NVCC flags?

2018-07-30 Thread Quang Ha
d remove CUDA from the project(...) call. > Currently if nvcc is not found, configuration will fail because you have > CUDA in the project command which makes it required. > > Hope that helps! > > -Stephen > > On Tue, Jul 24, 2018, 1:48 PM Quang Ha wrote: > >>

[CMake] CMAKE doesn't pass NVCC flags?

2018-07-24 Thread Quang Ha
So, it doesn't seem that my setting in NVCC flags is being used: In CMakeLists.txt: project(tangram LANGUAGES CXX CUDA) [...] FIND_PACKAGE(CUDA REQUIRED) if(CUDA_FOUND) add_definitions(-DCUDA_CALLABLE="__host__ __device__") set(CUDA_NVCC_FLAGS

[CMake] CMake tried to pass all flags from gcc into nvcc when trying to add CUDA extension to current CPP project

2018-07-09 Thread Quang Ha
Hi all, The situation I am currently in is as followed. This is the directory for my project: project |--CMakeLists.txt |--app ||CMakeLists.txt ||test_cuda | |CMakeLists.txt |

Re: [CMake] Using CMake to link C++ and CUDA Object file

2018-07-06 Thread Quang Ha
notice is that you makefile example is not building > shared libraries but object files, so to the same in CMake you need to use > 'add_library' with the OBJECT keyword not the SHARED keyword. > > > > On Fri, Jul 6, 2018 at 12:01 AM Quang Ha wrote: > >> Hi all, >> >>

[CMake] Using CMake to link C++ and CUDA Object file

2018-07-05 Thread Quang Ha
Hi all, Following upon how to perform code linking between CUDA and C++ (here at https://devblogs.nvidia.com/separate-compilation-linking-cuda-device-code/), I have successfully come up with a Makefile that is currently working for my test case: