Skip to content
Snippets Groups Projects
Commit 1e6a34f8 authored by LEGOLAS\lenz's avatar LEGOLAS\lenz
Browse files

enables OpenMP for GKS computations on CPU

parent 7d531e0a
No related branches found
No related tags found
No related merge requests found
...@@ -4,6 +4,7 @@ find_package(OpenMP) ...@@ -4,6 +4,7 @@ find_package(OpenMP)
if (OPENMP_FOUND) if (OPENMP_FOUND)
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}") set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}") set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
set (CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Xcompiler ${OpenMP_CXX_FLAGS}")
endif() endif()
endmacro(linkOpenMP) endmacro(linkOpenMP)
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
#include <string> #include <string>
#include <device_launch_parameters.h> #include <device_launch_parameters.h>
#include <omp.h>
#include "CudaUtility/CudaUtility.h" #include "CudaUtility/CudaUtility.h"
...@@ -49,7 +50,8 @@ void runKernel(KernelFunctor kernel, FunctionFunctor function, std::string devic ...@@ -49,7 +50,8 @@ void runKernel(KernelFunctor kernel, FunctionFunctor function, std::string devic
} }
else else
{ {
for( uint index = 0; index < grid.numberOfEntities; index++ ) #pragma omp parallel for
for( int index = 0; index < grid.numberOfEntities; index++ )
{ {
function( args..., index ); function( args..., index );
} }
......
include (${CMAKE_SOURCE_DIR}/${cmakeMacroPath}/Cuda/Link.cmake) include (${CMAKE_SOURCE_DIR}/${cmakeMacroPath}/Cuda/Link.cmake)
linkCuda(${targetName}) linkCuda(${targetName})
include (${CMAKE_SOURCE_DIR}/${cmakeMacroPath}/OpenMP/Link.cmake)
linkOpenMP(${targetName})
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