Skip to content
Snippets Groups Projects
Commit b0844cd2 authored by Bram Veenboer's avatar Bram Veenboer
Browse files

Merge branch 'update-cmake'

parents 8bac07d6 1c4d5c29
No related branches found
No related tags found
No related merge requests found
...@@ -11,12 +11,12 @@ set(DEDISP_VERSION_PATCH 1) ...@@ -11,12 +11,12 @@ set(DEDISP_VERSION_PATCH 1)
set(DEDISP_VERSION ${DEDISP_VERSION_MAJOR}.${DEDISP_VERSION_MINOR}.${DEDISP_VERSION_PATCH} ) set(DEDISP_VERSION ${DEDISP_VERSION_MAJOR}.${DEDISP_VERSION_MINOR}.${DEDISP_VERSION_PATCH} )
# cmake configuration # cmake configuration
cmake_minimum_required(VERSION 2.8) cmake_minimum_required(VERSION 3.9)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
# dependencies # dependencies
find_package(CUDA) find_package(CUDA REQUIRED)
# set Release as default build type # set Release as default build type
if(NOT CMAKE_BUILD_TYPE) if(NOT CMAKE_BUILD_TYPE)
...@@ -31,13 +31,13 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) ...@@ -31,13 +31,13 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON)
################################################################################ ################################################################################
# options # options
################################################################################ ################################################################################
option(ENABLE_BENCHMARK on) option(ENABLE_BENCHMARK ON)
if (ENABLE_BENCHMARK) if (ENABLE_BENCHMARK)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DDEDISP_BENCHMARK") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DDEDISP_BENCHMARK")
endif() endif()
option(ENABLE_DEBUG off) option(ENABLE_DEBUG OFF)
if (ENABLE_DEBUG) if (ENABLE_DEBUG)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DDEDISP_DEBUG") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DDEDISP_DEBUG")
...@@ -61,13 +61,7 @@ endif() ...@@ -61,13 +61,7 @@ endif()
################################################################################ ################################################################################
# OpenMP configuration # OpenMP configuration
################################################################################ ################################################################################
find_package(OpenMP) find_package(OpenMP REQUIRED)
if(OPENMP_FOUND)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}")
endif()
################################################################################ ################################################################################
......
...@@ -18,7 +18,6 @@ ...@@ -18,7 +18,6 @@
#include <Plan.hpp> #include <Plan.hpp>
#include "external/Stopwatch.h" #include "external/Stopwatch.h"
#include <omp.h>
#include <getopt.h> #include <getopt.h>
#include <string.h> #include <string.h>
......
...@@ -14,6 +14,12 @@ find_library( ...@@ -14,6 +14,12 @@ find_library(
PATH_SUFFIXES lib64) PATH_SUFFIXES lib64)
include(FindPackageHandleStandardArgs) include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(CUDA_nvToolsExt_LIBRARY DEFAULT_MSG CUDA_nvToolsExt_LIBRARY)
find_package_handle_standard_args(
CUDAnvToolsExt REQUIRED_VARS
CUDA_nvToolsExt_LIBRARY
)
mark_as_advanced(CUDAnvToolsExt_DIR)
endif(NOT CUDA_nvToolsExt_LIBRARY_FOUND) endif(NOT CUDA_nvToolsExt_LIBRARY_FOUND)
\ No newline at end of file
# - Try to find the FFTW3 library # - Try to find the FFTW3 library
# Variables used by this module: # Variables used by this module:
# FFTW3_ROOT_DIR - CUDA toolkit root directory # FFTW3_ROOT_DIR - FFTW3 root directory
# Variables defined by this module: # Variables defined by this module:
# FFTW3_FOUND - system has FFTW3_LIBRARY # FFTW3_FOUND - system has FFTW3_LIBRARY
# FFTW3_LIBRARY - the FFTW3_LIBRARY library # FFTW3_LIBRARY - the FFTW3_LIBRARY library
...@@ -33,16 +33,8 @@ find_library( ...@@ -33,16 +33,8 @@ find_library(
include(FindPackageHandleStandardArgs) include(FindPackageHandleStandardArgs)
find_package_handle_standard_args( find_package_handle_standard_args(
FFTW3_INCLUDE_DIR DEFAULT_MSG FFTW3 REQUIRED_VARS
FFTW3_INCLUDE_DIR FFTW3_INCLUDE_DIR
)
find_package_handle_standard_args(
FFTW3_LIBRARY DEFAULT_MSG
FFTW3_LIBRARY FFTW3_LIBRARY
)
find_package_handle_standard_args(
FFTW3F_LIBRARY DEFAULT_MSG
FFTW3F_LIBRARY FFTW3F_LIBRARY
) )
\ No newline at end of file
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
# include directory for common header files # include directory for common header files
include_directories(common) include_directories(common)
include_directories(${CUDA_TOOLKIT_INCLUDE})
# add subdirectories for individual libraries # add subdirectories for individual libraries
add_subdirectory(common) add_subdirectory(common)
...@@ -14,7 +15,6 @@ add_subdirectory(external) ...@@ -14,7 +15,6 @@ add_subdirectory(external)
# plan library # plan library
################################################################################ ################################################################################
add_library(plan OBJECT Plan.cpp GPUPlan.cpp) add_library(plan OBJECT Plan.cpp GPUPlan.cpp)
target_include_directories(plan PUBLIC ${CUDA_TOOLKIT_INCLUDE})
################################################################################ ################################################################################
......
add_library(common OBJECT add_library(common SHARED
dedisp_error.cpp dedisp_error.cpp
helper.cpp helper.cpp
) )
target_link_libraries(common OpenMP::OpenMP_CXX)
add_subdirectory(cuda) add_subdirectory(cuda)
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include "helper.h" #include "helper.h"
#include <unistd.h> // get total memory #include <unistd.h> // get total memory
#include <sys/resource.h> // get used memory #include <sys/resource.h> // get used memory
#include <omp.h>
namespace dedisp namespace dedisp
{ {
......
...@@ -8,8 +8,6 @@ ...@@ -8,8 +8,6 @@
#include <cstddef> #include <cstddef>
#include "omp.h"
namespace dedisp namespace dedisp
{ {
......
...@@ -7,7 +7,6 @@ cuda_add_library( ...@@ -7,7 +7,6 @@ cuda_add_library(
dedisperse/dedisperse.cu dedisperse/dedisperse.cu
unpack/unpack.cu unpack/unpack.cu
transpose/transpose.cu transpose/transpose.cu
$<TARGET_OBJECTS:common>
$<TARGET_OBJECTS:plan> $<TARGET_OBJECTS:plan>
$<TARGET_OBJECTS:external> $<TARGET_OBJECTS:external>
$<TARGET_OBJECTS:clib> $<TARGET_OBJECTS:clib>
...@@ -15,6 +14,7 @@ cuda_add_library( ...@@ -15,6 +14,7 @@ cuda_add_library(
target_link_libraries( target_link_libraries(
dedisp dedisp
common
cu cu
tdd tdd
fdd fdd
......
...@@ -89,6 +89,7 @@ bool dedisperse(const dedisp_word* d_in, ...@@ -89,6 +89,7 @@ bool dedisperse(const dedisp_word* d_in,
// -------------------------------------- // --------------------------------------
// Determine whether we should use texture memory // Determine whether we should use texture memory
bool use_texture_mem = check_use_texture_mem(); bool use_texture_mem = check_use_texture_mem();
#if (__CUDACC_VER_MAJOR__ < 11)
if( use_texture_mem ) { if( use_texture_mem ) {
dedisp_size chans_per_word = sizeof(dedisp_word)*BITS_PER_BYTE / in_nbits; dedisp_size chans_per_word = sizeof(dedisp_word)*BITS_PER_BYTE / in_nbits;
dedisp_size nchan_words = nchans / chans_per_word; dedisp_size nchan_words = nchans / chans_per_word;
...@@ -109,6 +110,9 @@ bool dedisperse(const dedisp_word* d_in, ...@@ -109,6 +110,9 @@ bool dedisperse(const dedisp_word* d_in,
} }
#endif // DEDISP_DEBUG #endif // DEDISP_DEBUG
} }
#else
use_texture_mem = false;
#endif
// -------------------------------------- // --------------------------------------
// Define thread decomposition // Define thread decomposition
......
...@@ -4,7 +4,6 @@ cuda_add_library(fdd SHARED ...@@ -4,7 +4,6 @@ cuda_add_library(fdd SHARED
dedisperse/FDDKernel.cu dedisperse/FDDKernel.cu
unpack/unpack.cu unpack/unpack.cu
chunk.cpp chunk.cpp
$<TARGET_OBJECTS:common>
$<TARGET_OBJECTS:plan> $<TARGET_OBJECTS:plan>
$<TARGET_OBJECTS:external> $<TARGET_OBJECTS:external>
) )
...@@ -13,7 +12,9 @@ find_package(FFTW3 REQUIRED true) ...@@ -13,7 +12,9 @@ find_package(FFTW3 REQUIRED true)
target_link_libraries(fdd target_link_libraries(fdd
${FFTW3F_LIBRARY} ${FFTW3F_LIBRARY}
common
cu cu
OpenMP::OpenMP_CXX
) )
target_include_directories(fdd target_include_directories(fdd
......
...@@ -3,13 +3,13 @@ cuda_add_library( ...@@ -3,13 +3,13 @@ cuda_add_library(
TDDPlan.cpp TDDPlan.cpp
dedisperse/TDDKernel.cu dedisperse/TDDKernel.cu
unpack/unpack.cu unpack/unpack.cu
$<TARGET_OBJECTS:common>
$<TARGET_OBJECTS:plan> $<TARGET_OBJECTS:plan>
$<TARGET_OBJECTS:external> $<TARGET_OBJECTS:external>
) )
target_link_libraries( target_link_libraries(
tdd tdd
common
cu cu
) )
......
...@@ -49,6 +49,15 @@ unsigned int DedispKernel::get_nsamps_per_thread() ...@@ -49,6 +49,15 @@ unsigned int DedispKernel::get_nsamps_per_thread()
return DEDISP_SAMPS_PER_THREAD; return DEDISP_SAMPS_PER_THREAD;
} }
void DedispKernel::use_texture_memory(bool enabled)
{
#if (__CUDACC_VER_MAJOR__ < 11)
m_use_texture_mem = enabled;
#else
m_use_texture_mem = false;
#endif
}
/* /*
* dedisperse routine * dedisperse routine
*/ */
...@@ -79,6 +88,7 @@ void DedispKernel::launch( ...@@ -79,6 +88,7 @@ void DedispKernel::launch(
// Initialise texture memory if necessary // Initialise texture memory if necessary
// -------------------------------------- // --------------------------------------
#if (__CUDACC_VER_MAJOR__ < 11)
if (m_use_texture_mem && d_in != m_d_in) if (m_use_texture_mem && d_in != m_d_in)
{ {
m_d_in = (dedisp_word *) d_in; m_d_in = (dedisp_word *) d_in;
...@@ -99,6 +109,7 @@ void DedispKernel::launch( ...@@ -99,6 +109,7 @@ void DedispKernel::launch(
input_words * sizeof(dedisp_word)) input_words * sizeof(dedisp_word))
); );
} }
#endif
// -------------------------------------- // --------------------------------------
// Define thread decomposition // Define thread decomposition
......
...@@ -23,7 +23,7 @@ class DedispKernel ...@@ -23,7 +23,7 @@ class DedispKernel
unsigned int get_nsamps_per_thread(); unsigned int get_nsamps_per_thread();
void use_texture_memory(bool enabled) { m_use_texture_mem = enabled; }; void use_texture_memory(bool enabled);
void launch( void launch(
const dedisp_word* d_in, const dedisp_word* d_in,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment