Commit d100e4cb authored by Tomáš Oberhuber's avatar Tomáš Oberhuber
Browse files

Fixing compilation with CUDA.

parent 4b373cf5
Loading
Loading
Loading
Loading
+12 −10
Original line number Diff line number Diff line
@@ -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" )
+13 −10
Original line number Diff line number Diff line
@@ -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 );
   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 )
{