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

Refactoring the reduction on the CUDA device.

Explicit instantiation of template CUDA reduction.
parent 8b4397ce
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=yes
WITH_CUDA=no
WITH_CUSPARSE=no
CUDA_ARCHITECTURE=2.0
VERBOSE=1
+37 −16
Original line number Diff line number Diff line
@@ -10,14 +10,29 @@ ADD_SUBDIRECTORY( solvers )
ADD_SUBDIRECTORY( legacy )
ADD_SUBDIRECTORY( implementation )

ADD_LIBRARY( tnl${debugExt}-${tnlVersion} SHARED 
               ${tnl_config_SOURCES}
set( tnl_SOURCES ${tnl_config_SOURCES}
                 ${tnl_core_SOURCES}
                 ${tnl_implementation_SOURCES}
                 ${tnl_legacy_SOURCES}
                 ${tnl_debug_SOURCES}
                 ${tnl_matrix_SOURCES} )

set( tnl_CUDA__SOURCES ${tnl_config_CUDA__SOURCES}
                       ${tnl_core_CUDA__SOURCES}
                       ${tnl_implementation_CUDA__SOURCES}
                       ${tnl_legacy_CUDA__SOURCES}
                       ${tnl_debug_CUDA__SOURCES}
                       ${tnl_matrix_CUDA__SOURCES} )
                 
                 
if( BUILD_CUDA )
   CUDA_ADD_LIBRARY( tnl${debugExt}-${tnlVersion} SHARED 
                     ${tnl_CUDA__SOURCES} )
else( BUILD_CUDA )
   ADD_LIBRARY( tnl${debugExt}-${tnlVersion} SHARED 
                ${tnl_SOURCES} )
endif( BUILD_CUDA )                                    
               
SET_TARGET_PROPERTIES( tnl${debugExt}-${tnlVersion} PROPERTIES 
                          SOVERSION 0 
                          VERSION ${tnlVersion} )
@@ -26,19 +41,25 @@ TARGET_LINK_LIBRARIES( tnl${debugExt}-${tnlVersion}
INSTALL( TARGETS tnl${debugExt}-${tnlVersion} DESTINATION lib )

IF( BUILD_MPI )
   
   if( BUILD_CUDA )
      CUDA_ADD_LIBRARY( tnl-mpi${debugExt}-${tnlVersion} SHARED
                        ${tnl_CUDA__SOURCES} )
   else( BUILD_CUDA )
         ADD_LIBRARY( tnl-mpi${debugExt}-${tnlVersion} SHARED
                 ${tnl_config_SOURCES}
                 ${tnl_core_SOURCES}
                 ${tnl_implementation_SOURCES}
                 ${tnl_debug_SOURCES}
                 ${tnl_matrix_SOURCES} )
                      ${tnl_SOURCES} )  
   endif( BUILD_CUDA )                        
   
   SET_TARGET_PROPERTIES( tnl-mpi${debugExt}-${tnlVersion} PROPERTIES
                            SOVERSION 0 
                            VERSION ${tnlVersion} ) 
   
   TARGET_LINK_LIBRARIES( tnl-mpi${debugExt}-${tnlVersion} 
                            ${MPI_LIBRARIES} 
                            ${BZIP2_LIBRARIES} )
   
   INSTALL( TARGETS tnl-mpi${debugExt}-${tnlVersion} DESTINATION lib )
                                                                
ENDIF()

+11 −3
Original line number Diff line number Diff line
@@ -13,12 +13,20 @@ SET( headers tnlConfigDescription.h
    )

SET( CURRENT_DIR ${CMAKE_SOURCE_DIR}/src/config )
SET( tnl_config_SOURCES 
set( common_SOURCES
     ${CURRENT_DIR}/tnlConfigDescription.cpp 
     ${CURRENT_DIR}/tnlConfigDescriptionScanner.cpp 
     ${CURRENT_DIR}/tnlConfigDescriptionParser.cpp 
     ${CURRENT_DIR}/tnlParameterContainer.cpp 
     ${CURRENT_DIR}/parse.cc
     ${CURRENT_DIR}/parse.cc )
SET( tnl_config_SOURCES 
     ${common_SOURCES}
     PARENT_SCOPE )

if( BUILD_CUDA )
SET( tnl_config_CUDA__SOURCES
     ${common_SOURCES} 
     PARENT_SCOPE )
endif()    

INSTALL( FILES ${headers} DESTINATION include/tnl-${tnlVersion}/config )
+1 −1
Original line number Diff line number Diff line
set( headers device-check.h
             reduction.h
             cuda-reduction.h
             reduction-operations.h )

INSTALL( FILES ${headers} DESTINATION include/tnl-${tnlVersion}/core/cuda )
 No newline at end of file
+13 −6
Original line number Diff line number Diff line
/***************************************************************************
                          reduction-operations_impl.h  -  description
                          cuda-reduction.h  -  description
                             -------------------
    begin                : Mar 22, 2013
    copyright            : (C) 2013 by Tomas Oberhuber
    begin                : Oct 28, 2010
    copyright            : (C) 2010 by Tomas Oberhuber
    email                : tomas.oberhuber@fjfi.cvut.cz
 ***************************************************************************/

@@ -15,9 +15,16 @@
 *                                                                         *
 ***************************************************************************/

#ifndef REDUCTION_OPERATIONS_IMPL_H_
#define REDUCTION_OPERATIONS_IMPL_H_
#ifndef CUDA_REDUCTION_H_
#define CUDA_REDUCTION_H_

template< typename Operation >
bool reductionOnCudaDevice( const Operation& operation,
                            const typename Operation :: IndexType size,
                            const typename Operation :: RealType* deviceInput1,
                            const typename Operation :: RealType* deviceInput2,
                            typename Operation :: ResultType& result );

#include <implementation/core/cuda/cuda-reduction_impl.h>

#endif /* REDUCTION_OPERATIONS_IMPL_H_ */
#endif /* CUDA_REDUCTION_H_ */
Loading