Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Omprng #2

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions .cmake-sycl-amd/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
cmake_minimum_required(VERSION 3.1.14 FATAL_ERROR)
project(wire-cell-gen-sycl CXX)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_EXTENSIONS Off)


file(GLOB all_files ${PROJECT_SOURCE_DIR}/../src/*.cxx)



set(BOOST_ROOT $ENV{BOOST_DIR} )
#set(BOOST_INCLUDEDIR $ENV{BOOST_INC})
#set(BOOST_LIBRARYDIR $ENV{BOOST_LIB})

find_package(Boost REQUIRED COMPONENTS)
#include_directories(Boost_INCLUDE_DIRS})
set(Boost_USE_MULTITHREADED ON)


#string(APPEND CMAKE_CXX_FLAGS "-g -O3 -fopenmp -pedantic -Wall -fsycl -fsycl-targets=amdgcn-amd-amdhsa -Xsycl-target-backend --offload-arch=gfx906")
string(APPEND CMAKE_CXX_FLAGS "-g -O3 -fopenmp -pedantic -Wall -fsycl $ENV{SYCL_CLANG_EXTRA_FLAGS}")
string(APPEND CMAKE_SHARED_LINKER_FLAGS "-Wl,--no-undefined")

add_library(WireCellGenSycl SHARED ${all_files})

list(APPEND CMAKE_PREFIX_PATH /opt/rocm )
#find_package(hip)
find_package(rocrand)
find_package(hipfft)

target_include_directories(WireCellGenSycl
PRIVATE
${PROJECT_SOURCE_DIR}/../inc
$ENV{OMPRNG}
$ENV{HIP_DIR}/include
$ENV{HIPFFT_INC}
$ENV{EIGEN_INC}
$ENV{JSONCPP_INC}
$ENV{JSONNET_INC}
$ENV{SPDLOG_INC}
$ENV{WIRECELL_INC}
)
set_target_properties(WireCellGenSycl
PROPERTIES COMPILE_OPTIONS "-DEIGEN_NO_CUDA;-DEIGEN_DONT_VECTORIZE;-DSYCL_TARGET_HIP")
target_link_directories(WireCellGenSycl PRIVATE $ENV{JSONCPP_LIB} $ENV{WIRECELL_LIB} $ENV{HIP_DIR}/lib )
target_link_libraries(WireCellGenSycl PRIVATE jsoncpp WireCellIface WireCellUtil Boost::headers roc::rocrand hip::hipfft amdhip64)

add_subdirectory(test)
22 changes: 22 additions & 0 deletions .cmake-sycl-amd/test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
set(all_execs
test_syclarray.cpp
)

set(source_dir ${PROJECT_SOURCE_DIR}/../test)

foreach(source_file IN LISTS all_execs)
get_filename_component(exec_name ${source_file} NAME_WE)
add_executable(${exec_name} ${source_dir}/${source_file})
target_link_directories(${exec_name} PRIVATE $ENV{WIRECELL_LIB})
target_link_libraries(${exec_name} PRIVATE WireCellGenSycl)
target_include_directories(${exec_name}
PRIVATE
${PROJECT_SOURCE_DIR}/../inc
$ENV{WIRECELL_INC}
$ENV{HIPFFT_INC}
$ENV{HIP_DIR}/include
)
set_target_properties(${exec_name}
PROPERTIES COMPILE_OPTIONS "-DSYCL_TARGET_HIP")

endforeach()
44 changes: 44 additions & 0 deletions .cmake-sycl-dpcpp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
cmake_minimum_required(VERSION 3.1.14 FATAL_ERROR)
project(wire-cell-gen-sycl CXX)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_EXTENSIONS Off)


file(GLOB all_files ${PROJECT_SOURCE_DIR}/../src/*.cxx)



set(BOOST_ROOT $ENV{BOOST_DIR} )
#set(BOOST_INCLUDEDIR $ENV{BOOST_INC})
#set(BOOST_LIBRARYDIR $ENV{BOOST_LIB})

find_package(Boost REQUIRED COMPONENTS)
#include_directories(Boost_INCLUDE_DIRS})
set(Boost_USE_MULTITHREADED ON)


#string(APPEND CMAKE_CXX_FLAGS "-g -O3 -fopenmp -pedantic -Wall -fsycl -fsycl-targets=amdgcn-amd-amdhsa -Xsycl-target-backend --offload-arch=gfx906")
string(APPEND CMAKE_CXX_FLAGS "-g -O3 -fopenmp -pedantic -Wall ")
string(APPEND CMAKE_SHARED_LINKER_FLAGS "-Wl,--no-undefined")

add_library(WireCellGenSycl SHARED ${all_files})


target_include_directories(WireCellGenSycl
PRIVATE
${PROJECT_SOURCE_DIR}/../inc
$ENV{OMPRNG}
$ENV{RANDOM123_INC}
$ENV{EIGEN_INC}
$ENV{JSONCPP_INC}
$ENV{JSONNET_INC}
$ENV{SPDLOG_INC}
$ENV{WIRECELL_INC}
)
set_target_properties(WireCellGenSycl
PROPERTIES COMPILE_OPTIONS "-DEIGEN_NO_CUDA;-DEIGEN_DONT_VECTORIZE")
target_link_directories(WireCellGenSycl PRIVATE $ENV{JSONCPP_LIB} $ENV{WIRECELL_LIB} )
target_link_libraries(WireCellGenSycl PRIVATE jsoncpp WireCellIface WireCellUtil Boost::headers)

add_subdirectory(test)
21 changes: 21 additions & 0 deletions .cmake-sycl-dpcpp/test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
set(all_execs
test_syclarray.cpp
)

set(source_dir ${PROJECT_SOURCE_DIR}/../test)

foreach(source_file IN LISTS all_execs)
get_filename_component(exec_name ${source_file} NAME_WE)
add_executable(${exec_name} ${source_dir}/${source_file})
target_link_directories(${exec_name} PRIVATE $ENV{WIRECELL_LIB})
target_link_libraries(${exec_name} PRIVATE WireCellGenSycl)
target_include_directories(${exec_name}
PRIVATE
${PROJECT_SOURCE_DIR}/../inc
$ENV{WIRECELL_INC}
$ENV{EIGEN_INC}
)
#set_target_properties(${exec_name}
# PROPERTIES COMPILE_OPTIONS "-DSYCL_TARGET_HIP")

endforeach()
7 changes: 4 additions & 3 deletions .cmake-sycl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,17 @@ add_library(WireCellGenSycl SHARED ${all_files})
target_include_directories(WireCellGenSycl
PRIVATE
${PROJECT_SOURCE_DIR}/../inc
$ENV{OMPRNG}
$ENV{EIGEN_INC}
$ENV{JSONCPP_INC}
$ENV{JSONNET_INC}
$ENV{SPDLOG_INC}
$ENV{WIRECELL_INC}
)
set_target_properties(WireCellGenSycl
PROPERTIES COMPILE_OPTIONS "-DEIGEN_NO_CUDA;-DEIGEN_DONT_VECTORIZE")
PROPERTIES COMPILE_OPTIONS "-DEIGEN_NO_CUDA;-DEIGEN_DONT_VECTORIZE;-DSYCL_TARGET_CUDA")

target_link_directories(WireCellGenSycl PRIVATE $ENV{JSONCPP_LIB} $ENV{WIRECELL_LIB} $ENV{ONEMKL_LIB})
target_link_libraries(WireCellGenSycl PRIVATE jsoncpp WireCellIface WireCellUtil onemkl Boost::headers ${CUDA_CUFFT_LIBRARIES})
target_link_directories(WireCellGenSycl PRIVATE $ENV{JSONCPP_LIB} $ENV{WIRECELL_LIB} })
target_link_libraries(WireCellGenSycl PRIVATE jsoncpp WireCellIface WireCellUtil Boost::headers ${CUDA_CUFFT_LIBRARIES} ${CUDA_curand_LIBRARY})

add_subdirectory(test)
1 change: 1 addition & 0 deletions .cmake-sycl/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@ foreach(source_file IN LISTS all_execs)
PRIVATE
${PROJECT_SOURCE_DIR}/../inc
$ENV{WIRECELL_INC}
$ENV{EIGEN_INC}
)
endforeach()
8 changes: 8 additions & 0 deletions inc/WireCellGenSycl/BinnedDiffusion_transform.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
#ifndef WIRECELL_GENSYCL_BINNEDDIFFUSION_TRANSFORM
#define WIRECELL_GENSYCL_BINNEDDIFFUSION_TRANSFORM

#ifdef __CUDA_ARCH__
#warning "__CUDA_ARCH__"
#undef __CUDA_ARCH__
#include <Eigen/Sparse>
#define __CUDA_ARCH__
#else
#include <Eigen/Sparse>
#endif

#include "WireCellUtil/Pimpos.h"
#include "WireCellUtil/Point.h"
#include "WireCellUtil/Units.h"
Expand Down
10 changes: 10 additions & 0 deletions inc/WireCellGenSycl/DepoTransform.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
#ifndef WIRECELL_GENSYCL_DEPOTRANSFORM
#define WIRECELL_GENSYCL_DEPOTRANSFORM

#ifdef __CUDA_ARCH__
#undef __CUDA_ARCH__
#define HAVE_CUDA
#endif

#include "WireCellIface/IDepoFramer.h"
#include "WireCellIface/IConfigurable.h"
#include "WireCellIface/IRandom.h"
Expand All @@ -13,6 +18,11 @@
#include "WireCellIface/IDepo.h"
#include "WireCellUtil/Logging.h"

#ifdef HAVE_CUDA
#undef HAVE_CUDA
#define __CUDA_ARCH__
#endif

#include <CL/sycl.hpp>

namespace WireCell {
Expand Down
14 changes: 14 additions & 0 deletions inc/WireCellGenSycl/GaussianDiffusion.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,25 @@
#ifndef WIRECELL_GENSYCL_GAUSSIANDIFFUSION
#define WIRECELL_GENSYCL_GAUSSIANDIFFUSION


#ifdef __CUDA_ARCH__
#define HAVE_CUDA
#undef __CUDA_ARCH__
#endif


#include "WireCellUtil/Array.h"
#include "WireCellUtil/Binning.h"
#include "WireCellIface/IDepo.h"
#include "WireCellIface/IRandom.h"


#ifdef HAVE_CUDA
#define __CUDA_ARCH_
#undef HAVE_CUDA
#endif


#include <memory>
#include <iostream>

Expand Down
12 changes: 12 additions & 0 deletions inc/WireCellGenSycl/ImpactData.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,21 @@
point in space where a field response function begins.
*/

#ifdef __CUDA_ARCH__
#undef __CUDA_ARCH__
#define HAVE_CUDA
#endif

#include "WireCellUtil/Waveform.h"

#ifdef HAVE_CUDA
#undef HAVE_CUDA
#define __CUDA_ARCH__
#endif

#include "WireCellGenSycl/GaussianDiffusion.h"


#include <memory>
#include <vector>

Expand Down
16 changes: 14 additions & 2 deletions inc/WireCellGenSycl/ImpactTransform.h
Original file line number Diff line number Diff line change
@@ -1,13 +1,25 @@
#ifndef WIRECELL_GENSYCL_IMPACTTRANSFORM
#define WIRECELL_GENSYCL_IMPACTTRANSFORM

#ifdef __CUDA_ARCH__
#define __CUDA_PASS__
#undef __CUDA_ARCH__
#endif

#include "WireCellIface/IPlaneImpactResponse.h"
#include "WireCellGenSycl/BinnedDiffusion_transform.h"
#include "WireCellUtil/Array.h"
#include "WireCellUtil/Logging.h"

#include <Eigen/Sparse>

#ifdef __CUDA_PASS__
#undef __cuda_PASS__
#define __CUDA_ARCH__
#endif



#include "WireCellGenSycl/BinnedDiffusion_transform.h"

namespace WireCell {
namespace GenSycl {

Expand Down
Loading