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

Debugging of explicit instantiations for CUDA memory operations.

parent c52cb76b
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
......@@ -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 )
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
PARENT_SCOPE )
endif()
set( tnl_implementation_core_cuda_SOURCES
${common_SOURCES}
${CURRENT_DIR}/cuda-reduction_impl.cpp
PARENT_SCOPE )
INSTALL( FILES ${headers} DESTINATION include/tnl-${tnlVersion}/implementation/core/cuda )
......@@ -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_ */
/***************************************************************************
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
......@@ -8,11 +8,22 @@ SET( headers tnlIterativeSolver_impl.h
tnlSolverStarter_impl.h
tnlSolverInitiator_impl.h )
SET( CURRENT_DIR ${CMAKE_SOURCE_DIR}/src/implementation/solvers )
SET( CURRENT_DIR ${CMAKE_SOURCE_DIR}/src/implementation/solvers )
set( common_SOURCES ${CURRENT_DIR}/tnlIterativeSolver_impl.cpp )
if( BUILD_CUDA)
set( tnl_implementation_solvers_CUDA__SOURCES
${tnl_implementation_solvers_linear_CUDA__SOURCES}
${tnl_implementation_solvers_ode_CUDA__SOURCES}
${tnl_implementation_solvers_pde_CUDA__SOURCES}
${common_SOURCES}
PARENT_SCOPE )
endif()
set( tnl_implementation_solvers_SOURCES
${tnl_implementation_solvers_linear_SOURCES}
${tnl_implementation_solvers_ode_SOURCES}
${CURRENT_DIR}/tnlIterativeSolver_impl.cpp
${common_SOURCES}
PARENT_SCOPE )
INSTALL( FILES ${headers} DESTINATION include/tnl-${tnlVersion}/implementation/solvers )
......
......@@ -4,9 +4,18 @@ ADD_SUBDIRECTORY( stationary )
SET( headers tnlLinearResidueGetter_impl.h
)
set( tnl_implementation_solvers_linear_SOURCES
SET( CURRENT_DIR ${CMAKE_SOURCE_DIR}/src/implementation/solvers/linear )
set( tnl_implementation_solvers_linear_stationary_SOURCES
${tnl_implementation_solvers_linear_krylov_SOURCES}
${tnl_implementation_solvers_linear_stationary_SOURCES}
PARENT_SCOPE )
if( BUILD_CUDA)
set( tnl_implementation_solvers_linear_CUDA__SOURCES
${tnl_implementation_solvers_linear_krylov_CUDA__SOURCES}
${tnl_implementation_solvers_linear_stationary_CUDA__SOURCES}
PARENT_SCOPE )
endif()
INSTALL( FILES ${headers} DESTINATION include/tnl-${tnlVersion}/implementation/solvers/linear )
\ No newline at end of file
......@@ -3,9 +3,16 @@ SET( headers tnlCGSolver_impl.h
tnlGMRESSolver_impl.h
)
SET( CURRENT_DIR ${CMAKE_SOURCE_DIR}/src/implementation/solvers/linear/krylov )
SET( CURRENT_DIR ${CMAKE_SOURCE_DIR}/src/implementation/solvers/linear/krylov )
set( common_SOURCES ${CURRENT_DIR}/tnlGMRESSolver_impl.cpp )
set( tnl_implementation_solvers_linear_krylov_SOURCES
${CURRENT_DIR}/tnlGMRESSolver_impl.cpp
${common_SOURCES}
PARENT_SCOPE )
if( BUILD_CUDA)
set( tnl_implementation_solvers_linear_krylov_CUDA__SOURCES
${common_SOURCES}
PARENT_SCOPE )
endif()
INSTALL( FILES ${headers} DESTINATION include/tnl-${tnlVersion}/implementation/solvers/linear/krylov )
......@@ -2,8 +2,16 @@ SET( headers tnlSORSolver_impl.h
)
SET( CURRENT_DIR ${CMAKE_SOURCE_DIR}/src/implementation/solvers/linear/stationary )
set( common_SOURCES ${CURRENT_DIR}/tnlSORSolver_impl.cpp )
set( tnl_implementation_solvers_linear_stationary_SOURCES
${CURRENT_DIR}/tnlSORSolver_impl.cpp
${common_SOURCES}
PARENT_SCOPE )
if( BUILD_CUDA)
set( tnl_implementation_solvers_linear_stationary_CUDA__SOURCES
${common_SOURCES}
PARENT_SCOPE )
endif()
INSTALL( FILES ${headers} DESTINATION include/tnl-${tnlVersion}/implementation/solvers/linear/stationary )
......@@ -13,11 +13,16 @@ SET( headers tnlAdaptiveRgCSRMatrix.h
)
SET( CURRENT_DIR ${CMAKE_SOURCE_DIR}/src/matrix )
set( common_SOURCES ${CURRENT_DIR}/tnlMatrix.cpp )
SET( tnl_matrix_SOURCES
${CURRENT_DIR}/tnlMatrix.cpp
${common_SOURCES}
PARENT_SCOPE )
#SET( libtnlmatrixincludedir ${TNL_INCLUDE_DIR}/matrix )
#SET( libtnlmatrixinclude_HEADERS ${headers} )
if( BUILD_CUDA )
SET( tnl_matrix_CUDA__SOURCES
${common_SOURCES}
PARENT_SCOPE )
endif()
INSTALL( FILES ${headers} DESTINATION include/tnl-${tnlVersion}/matrix )
\ No newline at end of file
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