Skip to content
Snippets Groups Projects
Commit d100e4cb authored by Tomáš Oberhuber's avatar Tomáš Oberhuber
Browse files

Fixing compilation with CUDA.

parent 4b373cf5
No related branches found
No related tags found
No related merge requests found
......@@ -33,22 +33,24 @@ if( CMAKE_BUILD_TYPE STREQUAL "Debug")
set( LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/Debug/lib )
set( EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/Debug/bin )
set( debugExt -dbg )
set( CMAKE_CXX_FLAGS "${CXXFLAGS} -g ")
AddCompilerFlag( "-std=c++11 -g -rdynamic" )
else()
set( PROJECT_BUILD_PATH ${PROJECT_SOURCE_DIR}/Release/src )
set( PROJECT_TESTS_PATH ${PROJECT_SOURCE_DIR}/Release/tests )
set( PROJECT_TOOLS_PATH ${PROJECT_SOURCE_DIR}/Release/tools )
set( LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/Release/lib)
set( EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/Release/bin)
AddCompilerFag( "-std=c++11 -O3 -march=native -DNDEBUG -g" )
endif()
# set Debug/Release options
set( CMAKE_CXX_FLAGS "-std=c++11" )
set( CMAKE_CXX_FLAGS_DEBUG "-g" )
set( CMAKE_CXX_FLAGS_RELEASE "-O3 -march=native -DNDEBUG -g" )
#set( CMAKE_CXX_FLAGS "-std=c++11" )
#set( CMAKE_CXX_FLAGS_DEBUG "-g" )
#set( CMAKE_CXX_FLAGS_RELEASE )
# pass -rdynamic only in Debug mode
set( CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "" )
set( CMAKE_SHARED_LIBRARY_LINK_C_FLAGS_DEBUG "-rdynamic" )
set( CMAKE_SHARED_LIBRARY_LINK_C_FLAGS_RELEASE "" )
#set( CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "" )
#set( CMAKE_SHARED_LIBRARY_LINK_C_FLAGS_DEBUG "" )
#set( CMAKE_SHARED_LIBRARY_LINK_C_FLAGS_RELEASE "" )
get_filename_component( CXX_COMPILER_NAME ${CMAKE_CXX_COMPILER} NAME )
if( CXX_COMPILER_NAME MATCHES "icpc" )
......@@ -65,8 +67,8 @@ if( WITH_CUDA STREQUAL "yes" )
set( BUILD_CUDA TRUE)
set(CUDA_ATTACH_VS_BUILD_RULE_TO_CUDA_FILE OFF)
set(BUILD_SHARED_LIBS ON)
set(CUDA_SEPARABLE_COMPILATION ON)
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} ; -DHAVE_CUDA )
set(CUDA_SEPARABLE_COMPILATION ON)
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} ;-DHAVE_CUDA )
#AddCompilerFlag( "-DHAVE_NOT_CXX11" ) # -U_GLIBCXX_ATOMIC_BUILTINS -U_GLIBCXX_USE_INT128 " )
set( ALL_CUDA_ARCHS -gencode arch=compute_20,code=sm_20
-gencode arch=compute_30,code=sm_30
......@@ -152,7 +154,7 @@ if( WITH_CUDA STREQUAL "yes" )
cuda_include_directories( ${CUSPARSE_INCLUDE_DIR} )
set( CUSPARSE_LIBRARY "${CUDA_cusparse_LIBRARY}" )
endif()
endif( NOT WITH_CUSPARSE STREQUAL "no" )
endif( NOT WITH_CUSPARSE STREQUAL "no" )
endif( CUDA_FOUND )
endif( WITH_CUDA STREQUAL "yes" )
......
......@@ -16,27 +16,30 @@
***************************************************************************/
#include <core/tnlCuda.h>
#include <config/tnlConfigDescription.h>
#include <config/tnlParameterContainer.h>
void tnlCuda::configSetup( tnlConfigDescription& config, const tnlString& prefix )
/*void tnlCuda::configSetup( tnlConfigDescription& config, const tnlString& prefix )
{
#ifdef HAVE_CUDA
//config.addEntry< bool >( prefix + "omp-enabled", "Enable support of OpenMP.", true );
//config.addEntry< int >( prefix + "omp-max-threads", "Set maximum number of OpenMP threads.", omp_get_max_threads() );
config.addEntry< int >( prefix + "cuda-device", "Choose CUDA device.", 0 );
#else
//config.addEntry< bool >( prefix + "omp-enabled", "Enable support of OpenMP (not supported on this system).", false );
//config.addEntry< int >( prefix + "omp-max-threads", "Set maximum number of OpenMP threads (not supported on this system).", 0 );
#endif
config.addEntry< int >( prefix + "cuda-device", "Choose CUDA device (CUDA is not supported on this system).", 0 );
#endif
}
bool tnlCuda::setup( const tnlParameterContainer& parameters,
const tnlString& prefix )
{
//enable = parameters.getParameter< bool >( prefix + "omp-enabled" );
//maxThreadsCount = parameters.getParameter< int ( prefix + "omp-max-threads" );
int cudaDevice = parameters.getParameter< int >( prefix + "cuda-device" );
#ifdef HAVE_CUDA
cudaSetDevice( cudaDevice );
checkCudaDevice;
#endif
return true;
}
*/
bool tnlCuda::checkDevice( const char* file_name, int line )
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment