Commit 4f11871c authored by incardon's avatar incardon

hip compilable version

parent 73638071
......@@ -14,6 +14,7 @@ set(OPENFPM_PDATA_DIR CACHE PATH "OpenFPM_pdata dirs")
set(PETSC_ROOT CACHE PATH "If compiling with linear algebra indicate the PETSC root directory")
set(ENV{PETSC_DIR} ${PETSC_ROOT})
set(HIP_ENABLE CACHE BOOL "Enable HIP compiler")
set(AMD_ARCH_COMPILE "gfx900" CACHE STRING "AMD gpu architecture used to compile kernels")
set (CMAKE_CXX_STANDARD 11)
......@@ -59,10 +60,11 @@ if (HIP_ENABLE)
if(NOT HIP_FOUND)
message( FATAL_ERROR "HIP has not been found" )
endif()
if (HIP_ENABLE)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_EXTENSIONS OFF)
if (HIP_PLATFORM STREQUAL "nvcc")
string(APPEND CMAKE_CXX_FLAGS ${WARNING_SUPPRESSION_AND_OPTION_NVCC_STR})
endif()
message(STATUS "Found HIP compiler :${HIP_HIPCC_EXECUTABLE}")
endif()
if(CUDA_FOUND)
......
......@@ -16,6 +16,9 @@ if ( HIP_ENABLE AND HIP_FOUND )
../../openfpm_devices/src/Memleak_check.cpp
../../openfpm_devices/src/memory/PtrMemory.cpp)
#target_include_directories (io PUBLIC ${MPI_C_INCLUDE_DIRS}) # Well ........ it does not work, work around line below
set_property(TARGET io PROPERTY COMPILE_FLAGS "-I${MPI_C_INCLUDE_DIRS}")
else()
add_executable(io main.cpp
......@@ -47,6 +50,10 @@ if (CUDA_FOUND)
endif()
endif()
if (HIP_FOUND)
SET(CMAKE_EXE_LINKER_FLAGS "--amdgpu-target=${AMD_ARCH_COMPILE}")
endif()
target_include_directories (io PUBLIC ${CUDA_INCLUDE_DIRS})
target_include_directories (io PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_include_directories (io PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../../openfpm_devices/src/)
......
#include <hip/hip_runtime.h>
#include "config.h"
#define BOOST_TEST_DYN_LINK
#include <boost/test/unit_test.hpp>
......
......@@ -160,3 +160,19 @@ ${DEFINE_TEST_COVERAGE_MODE}
/* Version number of package */
#define VERSION "1.0.0"
#ifdef __HIPCC__
// We try to fool boost
#include "hip/hip_runtime.h"
#define __CUDACC__
#define __CUDACC_VER_MAJOR__ 10
#define __CUDACC_VER_MINOR__ 2
#define __CUDACC_VER_BUILD__ 243
#endif
#include "/home/i-bird/BOOST/include/boost/config.hpp"
#ifdef __HIPCC__
// End try to fool boost
#undef __CUDACC__
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment