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

Debugging of explicit instantiations for CUDA memory operations.

parent c52cb76b
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -2,7 +2,7 @@

TARGET=TNL
INSTALL_PREFIX=${HOME}/local
WITH_CUDA=no
WITH_CUDA=yes
WITH_CUSPARSE=no
CUDA_ARCHITECTURE=2.0
VERBOSE=1
+4 −5
Original line number Diff line number Diff line
@@ -33,7 +33,9 @@ set( common_SOURCES
     ${CURRENT_DIR}/tnlMultiArray_impl.cpp
     ${CURRENT_DIR}/tnlMultiVector_impl.cpp
     ${CURRENT_DIR}/tnlSharedVector_impl.cpp
     ${CURRENT_DIR}/tnlVector_impl.cpp )     
     ${CURRENT_DIR}/tnlVector_impl.cpp 
     ${CURRENT_DIR}/tnlArray_impl.cpp
     ${CURRENT_DIR}/tnlHost_impl.cpp )       

IF( BUILD_CUDA )
   set( tnl_implementation_core_CUDA__SOURCES
@@ -44,15 +46,12 @@ IF( BUILD_CUDA )
        ${CURRENT_DIR}/tnlVector_impl.cu 
        PARENT_SCOPE )
ENDIF()    

set( tnl_implementation_core_SOURCES     
     ${tnl_implementation_core_cuda_SOURCES}
     ${common_SOURCES}
     ${CURRENT_DIR}/memory-operations_impl.cpp
     ${CURRENT_DIR}/tnlArray_impl.cpp
     ${CURRENT_DIR}/tnlHost_impl.cpp
     PARENT_SCOPE )
        
    
        
INSTALL( FILES ${headers} DESTINATION include/tnl-${tnlVersion}/implementation/core )
+8 −11
Original line number Diff line number Diff line
SET( headers cuda-reduction_impl.h )

SET( CURRENT_DIR ${CMAKE_SOURCE_DIR}/src/implementation/core/cuda )

set( common_SOURCES ${CURRENT_DIR}/device-check.cpp ) 
IF( BUILD_CUDA )
   set( tnl_implementation_core_cuda_CUDA__SOURCES
        ${common_SOURCES}
        ${CURRENT_DIR}/cuda-reduction_impl.cu
        PARENT_SCOPE )        
else() 
   set( tnl_implementation_core_cuda_SOURCES
        ${CURRENT_DIR}/cuda-reduction_impl.cpp
        PARENT_SCOPE )               
endif() 

set( tnl_implementation_core_cuda_SOURCES
     ${tnl_implementation_core_cuda_SOURCES}
     ${CURRENT_DIR}/device-check.cpp
     ${common_SOURCES}
     ${CURRENT_DIR}/cuda-reduction_impl.cpp     
     PARENT_SCOPE )               
        
INSTALL( FILES ${headers} DESTINATION include/tnl-${tnlVersion}/implementation/core/cuda )
+49 −2
Original line number Diff line number Diff line
@@ -43,6 +43,7 @@ bool allocateMemoryCuda( Element*& data,
      data = 0;
   return checkCudaDevice;
#else
   cerr << "CUDA support is missing on this system " << __FILE__ << " line " << __LINE__ << "." << endl;
   return false;
#endif
}
@@ -61,7 +62,7 @@ bool freeMemoryCuda( Element* data )
      cudaFree( data );
      return checkCudaDevice;
#else
   cerr << "I am sorry but CUDA support is missing on this system " << __FILE__ << " line " << __LINE__ << "." << endl;
   cerr << "CUDA support is missing on this system " << __FILE__ << " line " << __LINE__ << "." << endl;
   return true;
#endif
}
@@ -111,7 +112,7 @@ bool setMemoryCuda( Element* data,

      return checkCudaDevice;
#else
      cerr << "I am sorry but CUDA support is missing on this system " << __FILE__ << " line " << __LINE__ << "." << endl;
      cerr << "CUDA support is missing on this system " << __FILE__ << " line " << __LINE__ << "." << endl;
      return false;
#endif

@@ -264,4 +265,50 @@ bool compareMemoryCuda( const Element* deviceData1,
#endif
}

#ifdef TEMPLATE_EXPLICIT_INSTANTIATION

#ifdef HAVE_CUDA
extern template bool copyMemoryCudaToHost( char* destination,
                                    const char* source,
                                    const int size );

extern template bool copyMemoryCudaToHost( int* destination,
                                    const int* source,
                                    const int size );

extern template bool copyMemoryCudaToHost( long int* destination,
                                    const long int* source,
                                    const int size );

extern template bool copyMemoryCudaToHost( float* destination,
                                    const float* source,
                                    const int size );

extern template bool copyMemoryCudaToHost( double* destination,
                                    const double* source,
                                    const int size );

extern template bool copyMemoryCudaToHost( char* destination,
                                    const char* source,
                                    const long int size );

extern template bool copyMemoryCudaToHost( int* destination,
                                    const int* source,
                                    const long int size );

extern template bool copyMemoryCudaToHost( long int* destination,
                                    const long int* source,
                                    const long int size );

extern template bool copyMemoryCudaToHost( float* destination,
                                    const float* source,
                                    const long int size );

extern template bool copyMemoryCudaToHost( double* destination,
                                    const double* source,
                                    const long int size );

#endif
#endif

#endif /* MEMORYFUNCTIONS_H_ */
+62 −0
Original line number Diff line number Diff line
/***************************************************************************
                          memory_operations_impl.cu  -  description
                             -------------------
    begin                : Mar 24, 2013
    copyright            : (C) 2013 by Tomas Oberhuber
    email                : tomas.oberhuber@fjfi.cvut.cz
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

#include <implementation/core/memory-operations.h>

#ifdef TEMPLATE_EXPLICIT_INSTANTIATION

template bool copyMemoryCudaToHost( char* destination,
                                    const char* source,
                                    const int size );
                                    
template bool copyMemoryCudaToHost( int* destination,
                                    const int* source,
                                    const int size );

template bool copyMemoryCudaToHost( long int* destination,
                                    const long int* source,
                                    const int size );

template bool copyMemoryCudaToHost( float* destination,
                                    const float* source,
                                    const int size );

template bool copyMemoryCudaToHost( double* destination,
                                    const double* source,
                                    const int size );

template bool copyMemoryCudaToHost( char* destination,
                                    const char* source,
                                    const long int size );
                                    
template bool copyMemoryCudaToHost( int* destination,
                                    const int* source,
                                    const long int size );

template bool copyMemoryCudaToHost( long int* destination,
                                    const long int* source,
                                    const long int size );

template bool copyMemoryCudaToHost( float* destination,
                                    const float* source,
                                    const long int size );

template bool copyMemoryCudaToHost( double* destination,
                                    const double* source,
                                    const long int size );
                                                                        
#endif                                    
 No newline at end of file
Loading