Commit c668fa47 authored by Evgeny Kusmenko's avatar Evgeny Kusmenko

Merge branch 'oneclick_nn_training' into 'master'

Bugfix: Don't request CUDA libraries if CUDA wasn't found

See merge request !39
parents 901e863c f442ef4e
Pipeline #110349 passed with stages
in 8 minutes and 52 seconds
......@@ -8,7 +8,7 @@
<groupId>de.monticore.lang.monticar</groupId>
<artifactId>cnnarch-caffe2-generator</artifactId>
<version>0.2.10-SNAPSHOT</version>
<version>0.2.11-SNAPSHOT</version>
<!-- == PROJECT DEPENDENCIES ============================================= -->
......
......@@ -136,13 +136,16 @@ public class CNNArch2Caffe2 extends CNNArchGenerator{
cMakeConfig.addModuleDependency(new CMakeFindModule("Armadillo", true));
cMakeConfig.addModuleDependency(new CMakeFindModule("Caffe2", true));
cMakeConfig.addCMakeCommand("set(LIBS ${LIBS} -lprotobuf -lglog -lgflags)");
cMakeConfig.addCMakeCommand("find_package(CUDA)" + "\n"
+ "set(INCLUDE_DIRS ${INCLUDE_DIRS} ${CUDA_INCLUDE_DIRS})" + "\n"
+ "set(LIBS ${LIBS} ${CUDA_LIBRARIES} ${CUDA_curand_LIBRARY})" + "\n");
cMakeConfig.addCMakeCommand("find_package(CUDA)" + "\n");
//Needed since CUDA cannot be found correctly (including CUDA_curand_LIBRARY)
cMakeConfig.addCMakeCommand("if(CUDA_FOUND)" + "\n" + " set(LIBS ${LIBS} caffe2 caffe2_gpu)"
+ "\n" + "else()" + "\n" + " set(LIBS ${LIBS} caffe2)" + "\n" + "endif()");
cMakeConfig.addCMakeCommand("if(CUDA_FOUND)" + "\n"
+ " set(LIBS ${LIBS} caffe2 caffe2_gpu)" + "\n"
+ " set(INCLUDE_DIRS ${INCLUDE_DIRS} ${CUDA_INCLUDE_DIRS})" + "\n"
+ " set(LIBS ${LIBS} ${CUDA_LIBRARIES} ${CUDA_curand_LIBRARY})" + "\n"
+ "else()" + "\n"
+ " set(LIBS ${LIBS} caffe2)" + "\n"
+ "endif()");
Map<String,String> fileContentMap = new HashMap<>();
for (FileContent fileContent : cMakeConfig.generateCMakeFiles()){
......
......@@ -17,11 +17,11 @@ set(LIBS ${LIBS} ${Caffe2_LIBRARIES})
# additional commands
set(LIBS ${LIBS} -lprotobuf -lglog -lgflags)
find_package(CUDA)
set(INCLUDE_DIRS ${INCLUDE_DIRS} ${CUDA_INCLUDE_DIRS})
set(LIBS ${LIBS} ${CUDA_LIBRARIES} ${CUDA_curand_LIBRARY})
if(CUDA_FOUND)
set(LIBS ${LIBS} caffe2 caffe2_gpu)
set(INCLUDE_DIRS ${INCLUDE_DIRS} ${CUDA_INCLUDE_DIRS})
set(LIBS ${LIBS} ${CUDA_LIBRARIES} ${CUDA_curand_LIBRARY})
else()
set(LIBS ${LIBS} caffe2)
endif()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment