Commit 8ebe5966 authored by Vít Hanousek's avatar Vít Hanousek
Browse files

Merge remote-tracking branch 'origin/develop' into MIC-devel

parents c6e9fef5 b4c7d0af
Loading
Loading
Loading
Loading
+10 −6
Original line number Diff line number Diff line
@@ -12,7 +12,7 @@
# Vladimir Klement
# Jakub Klinkovsky

cmake_minimum_required( VERSION 3.0 )
cmake_minimum_required( VERSION 3.4 )

project( tnl )

@@ -33,7 +33,6 @@ 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 ")
else()
    set( PROJECT_BUILD_PATH ${PROJECT_SOURCE_DIR}/Release/src )
    set( PROJECT_TESTS_PATH ${PROJECT_SOURCE_DIR}/Release/tests )
@@ -41,10 +40,12 @@ else()
    set( LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/Release/lib)
    set( EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/Release/bin)
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_RELEASE "-O3 -march=native -DNDEBUG" )
#set( CMAKE_CXX_FLAGS_RELEASE "-O3 -march=native -DNDEBUG -ftree-vectorizer-verbose=1 -ftree-vectorize -fopt-info-vec-missed -funroll-loops" )
# pass -rdynamic only in Debug mode
set( CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "" )
set( CMAKE_SHARED_LIBRARY_LINK_C_FLAGS_DEBUG "-rdynamic" )
@@ -110,6 +111,9 @@ if( WITH_CUDA STREQUAL "yes" )
        set( CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} ; ${CUDA_ARCH} )
        # TODO: this is necessary only due to a bug in cmake
        set( CUDA_ADD_LIBRARY_OPTIONS -shared )
        # TODO: workaround for a bug in cmake 3.5.0 (fixed in 3.5.1)
        set( CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} ; -ccbin "${CMAKE_CXX_COMPILER}" )
        set( CUDA_HOST_COMPILER "" )

        ####
        # Check for cuBLAS
+6 −2
Original line number Diff line number Diff line
@@ -15,10 +15,12 @@ set (headers tnlAssert.h
             tnlDynamicTypeTag.h
             tnlFeature.h
             tnlFile.h 
             tnlFile_impl.h
             tnlFlopsCounter.h
             tnlHost.h 
             tnlIndexedSet.h
             tnlList.h
             tnlList_impl.h
             tnlLogger.h
             tnlObject.h 
             tnlStack.h
@@ -26,6 +28,7 @@ set (headers tnlAssert.h
             tnlStatistics.h 
             tnlString.h 
             tnlReal.h
             tnlTimer.h
             tnlTimerCPU.h  
             tnlTimerRT.h    
             mfilename.h 
@@ -45,6 +48,7 @@ set( common_SOURCES
     ${CURRENT_DIR}/tnlObject.cpp
     ${CURRENT_DIR}/tnlStatistics.cpp
     ${CURRENT_DIR}/tnlString.cpp 
     ${CURRENT_DIR}/tnlTimer.cpp 
     ${CURRENT_DIR}/tnlTimerCPU.cpp      
     ${CURRENT_DIR}/mfilename.cpp 
     ${CURRENT_DIR}/mpi-supp.cpp 
+7 −6
Original line number Diff line number Diff line
@@ -18,12 +18,13 @@
#ifndef TERMINAL_COLORS_H
#define	TERMINAL_COLORS_H

const std::string red( "\033[0;31m" );
const std::string green( "\033[1;32m" );
const std::string yellow( "\033[1;33m" );
const std::string cyan( "\033[0;36m" );
const std::string magenta( "\033[0;35m" );
const std::string reset( "\033[0m" );
const tnlString red( "\033[0;31m" );
const tnlString green( "\033[1;32m" );
const tnlString yellow( "\033[1;33m" );
const tnlString cyan( "\033[0;36m" );
const tnlString magenta( "\033[0;35m" );
const tnlString bold(); 
const tnlString reset( "\033[0m" );


#endif	/* TERMINAL_COLORS_H */
+26 −1
Original line number Diff line number Diff line
@@ -18,6 +18,8 @@
#include <core/tnlCuda.h>
#include <core/mfuncs.h>
#include <tnlConfig.h>
#include <config/tnlConfigDescription.h>
#include <config/tnlParameterContainer.h>

tnlString tnlCuda :: getDeviceType()
{
@@ -46,3 +48,26 @@ int tnlCuda::getNumberOfGrids( const int blocks,

}*/

void tnlCuda::configSetup( tnlConfigDescription& config, const tnlString& prefix )
{
#ifdef HAVE_CUDA
   config.addEntry<  int >( prefix + "cuda-device", "Choose CUDA device to run the computationon.", 0 );
#else
   config.addEntry<  int >( prefix + "cuda-device", "Choose CUDA device to run the computationon (not supported on this system).", 0 );
#endif
}
      
bool tnlCuda::setup( const tnlParameterContainer& parameters,
                      const tnlString& prefix )
{
#ifdef HAVE_CUDA
   int cudaDevice = parameters.getParameter< int >( "cuda-device" );
   if( cudaSetDevice( cudaDevice ) != cudaSuccess )
   {
      std::cerr << "I cannot activate CUDA device number " << cudaDevice << "." << std::endl;
      return false;
   }
#endif   
   return true;
}
+24 −0
Original line number Diff line number Diff line
@@ -16,6 +16,30 @@
 ***************************************************************************/

#include <core/tnlCuda.h>
#include <config/tnlConfigDescription.h>
#include <config/tnlParameterContainer.h>


/*void tnlCuda::configSetup( tnlConfigDescription& config, const tnlString& prefix )
{
#ifdef HAVE_CUDA
   config.addEntry< int >( prefix + "cuda-device", "Choose CUDA device.", 0 );
#else
   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 )
{
   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 )
{
Loading