Skip to content

Commit

Permalink
Rework backend folder structure (cms-patatrack#73)
Browse files Browse the repository at this point in the history
* Rename base alpaka folder as include

* Move BindingModules out of include

* Move include folder outside

* Move run.hpp

* Rename files

* Update include paths

* Update benchmarking scripts

* Update version
  • Loading branch information
sbaldu authored Jan 9, 2025
1 parent 0e48d51 commit 9f80fa3
Show file tree
Hide file tree
Showing 36 changed files with 85 additions and 91 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
#pragma once

#include <vector>

#include "CLUEAlgoAlpaka.h"
#include "CLUEstering/CLUEstering.hpp"

namespace ALPAKA_ACCELERATOR_NAMESPACE_CLUE {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include <alpaka/alpaka.hpp>
#include <vector>

#include "../CLUE/Run.h"
#include "Run.hpp"

#include <pybind11/pybind11.h>
#include <pybind11/stl.h>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include <alpaka/alpaka.hpp>
#include <vector>

#include "../CLUE/Run.h"
#include "Run.hpp"

#include <pybind11/pybind11.h>
#include <pybind11/stl.h>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@

#include <alpaka/alpaka.hpp>
#include <vector>

#include "../CLUE/Run.h"
#include "Run.hpp"

#include <pybind11/pybind11.h>
#include <pybind11/stl.h>
#include <pybind11/functional.h>

using cms::alpakatools::initialise;

namespace alpaka_cuda_async {
void listDevices(const std::string& backend) {
const char tab = '\t';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@

#include <alpaka/alpaka.hpp>
#include <vector>

#include "../CLUE/Run.h"
#include "Run.hpp"

#include <pybind11/pybind11.h>
#include <pybind11/stl.h>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

#include "../CLUE/ConvolutionalKernel.h"
#include "CLUEstering/CLUE/ConvolutionalKernel.hpp"

#include <pybind11/pybind11.h>
#include <pybind11/stl.h>
Expand Down
12 changes: 7 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,14 @@ if(NOT DEFINED SERIAL_ONLY)
set(SERIAL_ONLY OFF)
endif()

include_directories(include)

# create lib directory in CLUEstering folder
execute_process(COMMAND mkdir -p ./CLUEstering/lib)

# Convolutional Kernels compile convolutional kernel module
pybind11_add_module(CLUE_Convolutional_Kernels SHARED
./CLUEstering/alpaka/BindingModules/binding_kernels.cc)
CLUEstering/BindingModules/binding_kernels.cpp)
target_include_directories(
CLUE_Convolutional_Kernels PRIVATE ${alpaka_SOURCE_DIR}/include
${Boost_SOURCE_DIR})
Expand All @@ -69,7 +71,7 @@ endforeach()

# CPU Serial compile cpu serial module
pybind11_add_module(CLUE_CPU_Serial SHARED
./CLUEstering/alpaka/BindingModules/binding_cpu.cc)
CLUEstering/BindingModules/binding_cpu.cpp)
target_include_directories(CLUE_CPU_Serial PRIVATE ${alpaka_SOURCE_DIR}/include
${Boost_SOURCE_DIR})
# alpaka build flags
Expand All @@ -95,7 +97,7 @@ if(NOT ${SERIAL_ONLY})
if(TBB_FOUND)
# compile cpu tbb module
pybind11_add_module(CLUE_CPU_TBB SHARED
./CLUEstering/alpaka/BindingModules/binding_cpu_tbb.cc)
CLUEstering/BindingModules/binding_cpu_tbb.cpp)
target_include_directories(CLUE_CPU_TBB PRIVATE ${alpaka_SOURCE_DIR}/include
${Boost_SOURCE_DIR})
target_compile_options(
Expand Down Expand Up @@ -138,7 +140,7 @@ if((NOT ${CPU_ONLY}) AND (NOT ${SERIAL_ONLY}))
PROPERTIES LANGUAGE CUDA)
# compile gpu cuda module
pybind11_add_module(CLUE_GPU_CUDA SHARED
./CLUEstering/alpaka/BindingModules/binding_gpu_cuda.cc)
CLUEstering/BindingModules/binding_gpu_cuda.cpp)
target_include_directories(
CLUE_GPU_CUDA PRIVATE ${alpaka_SOURCE_DIR}/include ${Boost_SOURCE_DIR})
# set the cuda architectures
Expand Down Expand Up @@ -179,7 +181,7 @@ if((NOT ${CPU_ONLY}) AND (NOT ${SERIAL_ONLY}))
set(CMAKE_CXX_COMPILER "${hip_BASE}/bin/hipcc")
# compile gpu hip module
pybind11_add_module(CLUE_GPU_HIP SHARED
./CLUEstering/alpaka/BindingModules/binding_gpu_hip.cc)
CLUEstering/BindingModules/binding_gpu_hip.cpp)
target_include_directories(CLUE_GPU_HIP PRIVATE ${alpaka_SOURCE_DIR}/include
${Boost_SOURCE_DIR})
# alpaka build flags
Expand Down
12 changes: 6 additions & 6 deletions benchmark/dataset_size/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@ if(NOT DEFINED SERIAL_ONLY)
endif()

# include source directories
include_directories(../../CLUEstering/alpaka/)
include_directories(../../include/)

# CPU Serial
add_executable(serial.out main.cc)
add_executable(serial.out main.cpp)
target_include_directories(serial.out PRIVATE ${alpaka_PATH})
target_link_libraries(serial.out PRIVATE pybind11::embed)
# link boost
Expand All @@ -90,7 +90,7 @@ if(NOT ${SERIAL_ONLY})
# CPU TBB
if(TBB_FOUND)
# compile cpu tbb module
add_executable(tbb.out main.cc)
add_executable(tbb.out main.cpp)
target_include_directories(tbb.out PRIVATE ${alpaka_PATH})
target_link_libraries(tbb.out PRIVATE pybind11::embed)
target_link_libraries(tbb.out PRIVATE ${Boost_LIBRARIES})
Expand Down Expand Up @@ -129,9 +129,9 @@ if((NOT ${CPU_ONLY}) AND (NOT ${SERIAL_ONLY}))
set(CMAKE_CUDA_FLAGS "-Wall -Wextra -g -O2")

# compile the file with .cc extension using nvcc
set_source_files_properties(main.cc PROPERTIES LANGUAGE CUDA)
set_source_files_properties(main.cpp PROPERTIES LANGUAGE CUDA)
# compile gpu cuda module
add_executable(cuda.out main.cc)
add_executable(cuda.out main.cpp)
target_include_directories(cuda.out PRIVATE ${alpaka_PATH})
target_link_libraries(cuda.out PRIVATE pybind11::embed)
# link boost
Expand Down Expand Up @@ -164,7 +164,7 @@ if((NOT ${CPU_ONLY}) AND (NOT ${SERIAL_ONLY}))

# set(hip_BASE "${hip_INCLUDE_DIRS}/..") # set the hipcc compiler
# set(CMAKE_CXX_COMPILER "${hip_BASE}/bin/hipcc") # compile gpu hip module
# add_executable(hip.out main.cc) # link boost target_link_libraries(hip.out
# add_executable(hip.out main.cpp) # link boost target_link_libraries(hip.out
# PRIVATE ${Boost_LIBRARIES}) target_include_directories(hip.out PRIVATE
# ${Boost_PATH}) # alpaka build flags target_compile_options( hip.out PRIVATE
# -DALPAKA_ACC_GPU_HIP_PRESENT -DALPAKA_ACC_GPU_HIP_ENABLED
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@
#include <string>
#include <vector>

#include "CLUE/CLUEAlgoAlpaka.h"
#include "CLUE/Run.h"
#include "DataFormats/Points.h"
#include "DataFormats/alpaka/PointsAlpaka.h"
#include "CLUEstering/CLUEstering.hpp"
#include "CLUEstering/DataFormats/Points.hpp"
#include "CLUEstering/DataFormats/alpaka/PointsAlpaka.hpp"

#include "read_csv.hpp"

Expand Down
2 changes: 1 addition & 1 deletion benchmark/dataset_size/read_csv.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include <utility>
#include <vector>

#include "DataFormats/alpaka/AlpakaVecArray.h"
#include "CLUEstering/DataFormats/alpaka/AlpakaVecArray.hpp"

using clue::VecArray;

Expand Down
16 changes: 8 additions & 8 deletions benchmark/profiling/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
cmake_minimum_required(VERSION 3.16.0)
project(Profiling LANGUAGES CXX)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

Expand Down Expand Up @@ -61,10 +61,10 @@ if(NOT DEFINED SERIAL_ONLY)
endif()

# include source directories
include_directories(../../CLUEstering/alpaka/)
include_directories(../../include/)

# CPU Serial
add_executable(serial.out main.cc)
add_executable(serial.out main.cpp)
target_include_directories(serial.out PRIVATE ${alpaka_PATH})
# link boost
target_link_libraries(serial.out PRIVATE ${Boost_LIBRARIES})
Expand All @@ -87,7 +87,7 @@ if(NOT ${SERIAL_ONLY})
# CPU TBB
if(TBB_FOUND)
# compile cpu tbb module
add_executable(tbb.out main.cc)
add_executable(tbb.out main.cpp)
target_include_directories(tbb.out PRIVATE ${alpaka_PATH})
target_link_libraries(tbb.out PRIVATE ${Boost_LIBRARIES})
target_include_directories(tbb.out PRIVATE ${Boost_PATH})
Expand Down Expand Up @@ -118,16 +118,16 @@ if((NOT ${CPU_ONLY}) AND (NOT ${SERIAL_ONLY}))

# set the CUDA standard
if(NOT DEFINED CMAKE_CUDA_STANDARD)
set(CMAKE_CUDA_STANDARD 17)
set(CMAKE_CUDA_STANDARD 20)
set(CMAKE_CUDA_STANDARD_REQUIRED ON)
endif()

set(CMAKE_CUDA_FLAGS "-Wall -Wextra -g -O2")

# compile the file with .cc extension using nvcc
set_source_files_properties(main.cc PROPERTIES LANGUAGE CUDA)
set_source_files_properties(main.cpp PROPERTIES LANGUAGE CUDA)
# compile gpu cuda module
add_executable(cuda.out main.cc)
add_executable(cuda.out main.cpp)
target_include_directories(cuda.out PRIVATE ${alpaka_PATH})
# link boost
target_link_libraries(cuda.out PRIVATE ${Boost_LIBRARIES})
Expand Down Expand Up @@ -159,7 +159,7 @@ if((NOT ${CPU_ONLY}) AND (NOT ${SERIAL_ONLY}))

# set(hip_BASE "${hip_INCLUDE_DIRS}/..") # set the hipcc compiler
# set(CMAKE_CXX_COMPILER "${hip_BASE}/bin/hipcc") # compile gpu hip module
# add_executable(hip.out main.cc) # link boost target_link_libraries(hip.out
# add_executable(hip.out main.cpp) # link boost target_link_libraries(hip.out
# PRIVATE ${Boost_LIBRARIES}) target_include_directories(hip.out PRIVATE
# ${Boost_PATH}) # alpaka build flags target_compile_options( hip.out PRIVATE
# -DALPAKA_ACC_GPU_HIP_PRESENT -DALPAKA_ACC_GPU_HIP_ENABLED
Expand Down
10 changes: 4 additions & 6 deletions benchmark/profiling/main.cc → benchmark/profiling/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@
#include <chrono>
#include <vector>

#include "CLUE/CLUEAlgoAlpaka.h"
#include "CLUE/Run.h"
#include "DataFormats/Points.h"
#include "DataFormats/alpaka/PointsAlpaka.h"
#include "CLUEstering/CLUEstering.hpp"
#include "CLUEstering/DataFormats/Points.hpp"
#include "CLUEstering/DataFormats/alpaka/PointsAlpaka.hpp"

#include "read_csv.hpp"

Expand All @@ -31,6 +30,5 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE_CLUE {

int main(int argc, char* argv[]) {
auto input_file{std::string(argv[1])};
using ALPAKA_ACCELERATOR_NAMESPACE_CLUE;
run(input_file);
ALPAKA_ACCELERATOR_NAMESPACE_CLUE::run(input_file);
}
2 changes: 1 addition & 1 deletion benchmark/profiling/read_csv.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include <utility>
#include <vector>

#include "DataFormats/alpaka/AlpakaVecArray.h"
#include "CLUEstering/DataFormats/alpaka/AlpakaVecArray.hpp"

using clue::VecArray;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

#include <alpaka/alpaka.hpp>

#include "getDeviceCachingAllocator.h"
#include "getHostCachingAllocator.h"
#include "getDeviceCachingAllocator.hpp"
#include "getHostCachingAllocator.hpp"

namespace clue {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

#include <alpaka/alpaka.hpp>

#include "alpakaDevices.h"
#include "alpakaDevices.hpp"

// Inspired by cub::CachingDeviceAllocator

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

#include <alpaka/alpaka.hpp>

#include "../alpakaConfig.h"
#include "../alpakaDevices.h"
#include "../initialise.h"
#include "../demangle.h"
#include "../alpakaConfig.hpp"
#include "../alpakaDevices.hpp"
#include "../initialise.hpp"
#include "../demangle.hpp"

namespace clue {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

#pragma once

#include "alpakaFwd.h"
#include "alpakaFwd.hpp"
#include <alpaka/alpaka.hpp>

namespace alpaka_common {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

#include <alpaka/alpaka.hpp>

#include "alpakaConfig.h"
#include "getDeviceIndex.h"
#include "alpakaConfig.hpp"
#include "getDeviceIndex.hpp"

namespace clue {
// returns the alpaka accelerator platform
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#pragma once

#include <type_traits>
#include "initialise.h"
#include "initialise.hpp"

#if __cplusplus >= 202002L
namespace cms {
Expand All @@ -28,10 +28,10 @@ namespace cms {

#include <alpaka/alpaka.hpp>

#include "AllocatorPolicy.h"
#include "CachedBufAlloc.h"
#include "alpakaConfig.h"
#include "alpakaDevices.h"
#include "AllocatorPolicy.hpp"
#include "CachedBufAlloc.hpp"
#include "alpakaConfig.hpp"
#include "alpakaDevices.hpp"

namespace clue {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

#include <alpaka/alpaka.hpp>

#include "alpakaConfig.h"
#include "alpakaConfig.hpp"

using namespace alpaka_common;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@

#pragma once

#include "alpakaConfig.h"
#include "alpakaDevices.h"
#include "alpakaConfig.hpp"
#include "alpakaDevices.hpp"

namespace clue {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
#include <mutex>
#include <vector>

#include "AllocatorConfig.h"
#include "CachingAllocator.h"
#include "alpakaDevices.h"
#include "alpakaFwd.h"
#include "getDeviceIndex.h"
#include "AllocatorConfig.hpp"
#include "CachingAllocator.hpp"
#include "alpakaDevices.hpp"
#include "alpakaFwd.hpp"
#include "getDeviceIndex.hpp"

namespace clue {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@

#pragma once

#include "AllocatorConfig.h"
#include "CachingAllocator.h"
#include "alpakaDevices.h"
#include "AllocatorConfig.hpp"
#include "CachingAllocator.hpp"
#include "alpakaDevices.hpp"

namespace clue {

Expand Down
Loading

0 comments on commit 9f80fa3

Please sign in to comment.