diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index f0c6c6c..3620d48 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -55,9 +55,6 @@ jobs: test-cpp: runs-on: ubuntu-18.04 - defaults: - run: - working-directory: ./src steps: - uses: actions/checkout@v2 @@ -83,75 +80,75 @@ jobs: - name: Test compile gcc @ CMake 3.13 if: ${{ ! cancelled() }} - run: ./ci-test-compile.sh ./build gcc all ${{ env.CMAKE_3_13_BIN }} + run: ./src/ci-test-compile.sh ./build gcc all ${{ env.CMAKE_3_13_BIN }} - name: Test compile clang @ CMake 3.13 if: ${{ ! cancelled() }} - run: ./ci-test-compile.sh ./build clang all ${{ env.CMAKE_3_13_BIN }} + run: ./src/ci-test-compile.sh ./build clang all ${{ env.CMAKE_3_13_BIN }} - name: Test compile nvhpc @ CMake 3.13 if: ${{ ! cancelled() }} - run: ./ci-test-compile.sh ./build nvhpc all ${{ env.CMAKE_3_13_BIN }} + run: ./src/ci-test-compile.sh ./build nvhpc all ${{ env.CMAKE_3_13_BIN }} - name: Test compile aocc @ CMake 3.13 if: ${{ ! cancelled() }} - run: ./ci-test-compile.sh ./build aocc all ${{ env.CMAKE_3_13_BIN }} + run: ./src/ci-test-compile.sh ./build aocc all ${{ env.CMAKE_3_13_BIN }} - name: Test compile aomp @ CMake 3.13 if: ${{ ! cancelled() }} - run: ./ci-test-compile.sh ./build aomp all ${{ env.CMAKE_3_13_BIN }} + run: ./src/ci-test-compile.sh ./build aomp all ${{ env.CMAKE_3_13_BIN }} - name: Test compile hip @ CMake 3.13 if: ${{ ! cancelled() }} - run: ./ci-test-compile.sh ./build hip all ${{ env.CMAKE_3_13_BIN }} + run: ./src/ci-test-compile.sh ./build hip all ${{ env.CMAKE_3_13_BIN }} - name: Test compile dpcpp @ CMake 3.13 if: ${{ ! cancelled() }} - run: ./ci-test-compile.sh ./build dpcpp all ${{ env.CMAKE_3_13_BIN }} + run: ./src/ci-test-compile.sh ./build dpcpp all ${{ env.CMAKE_3_13_BIN }} - name: Test compile hipsycl @ CMake 3.13 if: ${{ ! cancelled() }} - run: ./ci-test-compile.sh ./build hipsycl all ${{ env.CMAKE_3_13_BIN }} + run: ./src/ci-test-compile.sh ./build hipsycl all ${{ env.CMAKE_3_13_BIN }} - name: Test compile gcc @ CMake 3.15 if: ${{ ! cancelled() }} - run: ./ci-test-compile.sh ./build gcc all ${{ env.CMAKE_3_15_BIN }} + run: ./src/ci-test-compile.sh ./build gcc all ${{ env.CMAKE_3_15_BIN }} - name: Test compile clang @ CMake 3.15 if: ${{ ! cancelled() }} - run: ./ci-test-compile.sh ./build clang all ${{ env.CMAKE_3_15_BIN }} + run: ./src/ci-test-compile.sh ./build clang all ${{ env.CMAKE_3_15_BIN }} - name: Test compile nvhpc @ CMake 3.15 if: ${{ ! cancelled() }} - run: ./ci-test-compile.sh ./build nvhpc all ${{ env.CMAKE_3_15_BIN }} + run: ./src/ci-test-compile.sh ./build nvhpc all ${{ env.CMAKE_3_15_BIN }} - name: Test compile aocc @ CMake 3.15 if: ${{ ! cancelled() }} - run: ./ci-test-compile.sh ./build aocc all ${{ env.CMAKE_3_15_BIN }} + run: ./src/ci-test-compile.sh ./build aocc all ${{ env.CMAKE_3_15_BIN }} - name: Test compile aomp @ CMake 3.15 if: ${{ ! cancelled() }} - run: ./ci-test-compile.sh ./build aomp all ${{ env.CMAKE_3_15_BIN }} + run: ./src/ci-test-compile.sh ./build aomp all ${{ env.CMAKE_3_15_BIN }} - name: Test compile hip @ CMake 3.15 if: ${{ ! cancelled() }} - run: ./ci-test-compile.sh ./build hip all ${{ env.CMAKE_3_15_BIN }} + run: ./src/ci-test-compile.sh ./build hip all ${{ env.CMAKE_3_15_BIN }} - name: Test compile dpcpp @ CMake 3.15 if: ${{ ! cancelled() }} - run: ./ci-test-compile.sh ./build dpcpp all ${{ env.CMAKE_3_15_BIN }} + run: ./src/ci-test-compile.sh ./build dpcpp all ${{ env.CMAKE_3_15_BIN }} - name: Test compile hipsycl @ CMake 3.15 if: ${{ ! cancelled() }} - run: ./ci-test-compile.sh ./build hipsycl all ${{ env.CMAKE_3_15_BIN }} + run: ./src/ci-test-compile.sh ./build hipsycl all ${{ env.CMAKE_3_15_BIN }} - name: Test compile gcc @ CMake 3.18 if: ${{ ! cancelled() }} - run: ./ci-test-compile.sh ./build gcc all ${{ env.CMAKE_3_18_BIN }} + run: ./src/ci-test-compile.sh ./build gcc all ${{ env.CMAKE_3_18_BIN }} - name: Test compile clang @ CMake 3.18 if: ${{ ! cancelled() }} - run: ./ci-test-compile.sh ./build clang all ${{ env.CMAKE_3_18_BIN }} + run: ./src/ci-test-compile.sh ./build clang all ${{ env.CMAKE_3_18_BIN }} - name: Test compile nvhpc @ CMake 3.18 if: ${{ ! cancelled() }} - run: ./ci-test-compile.sh ./build nvhpc all ${{ env.CMAKE_3_18_BIN }} + run: ./src/ci-test-compile.sh ./build nvhpc all ${{ env.CMAKE_3_18_BIN }} - name: Test compile aocc @ CMake 3.18 if: ${{ ! cancelled() }} - run: ./ci-test-compile.sh ./build aocc all ${{ env.CMAKE_3_18_BIN }} + run: ./src/ci-test-compile.sh ./build aocc all ${{ env.CMAKE_3_18_BIN }} - name: Test compile aomp @ CMake 3.18 if: ${{ ! cancelled() }} - run: ./ci-test-compile.sh ./build aomp all ${{ env.CMAKE_3_18_BIN }} + run: ./src/ci-test-compile.sh ./build aomp all ${{ env.CMAKE_3_18_BIN }} - name: Test compile hip @ CMake 3.18 if: ${{ ! cancelled() }} - run: ./ci-test-compile.sh ./build hip all ${{ env.CMAKE_3_18_BIN }} + run: ./src/ci-test-compile.sh ./build hip all ${{ env.CMAKE_3_18_BIN }} - name: Test compile dpcpp @ CMake 3.18 if: ${{ ! cancelled() }} - run: ./ci-test-compile.sh ./build dpcpp all ${{ env.CMAKE_3_18_BIN }} + run: ./src/ci-test-compile.sh ./build dpcpp all ${{ env.CMAKE_3_18_BIN }} - name: Test compile hipsycl @ CMake 3.18 if: ${{ ! cancelled() }} - run: ./ci-test-compile.sh ./build hipsycl all ${{ env.CMAKE_3_18_BIN }} \ No newline at end of file + run: ./src/ci-test-compile.sh ./build hipsycl all ${{ env.CMAKE_3_18_BIN }} \ No newline at end of file diff --git a/src/CMakeLists.txt b/CMakeLists.txt similarity index 97% rename from src/CMakeLists.txt rename to CMakeLists.txt index 553bfcb..58e0a3b 100644 --- a/src/CMakeLists.txt +++ b/CMakeLists.txt @@ -49,7 +49,7 @@ endmacro() #set(CXX_EXTRA_FLAGS -O2) #set(CMAKE_CXX_COMPILER /usr/lib/aomp/bin/clang++) -#set(MODEL OMP) +#set(MODEL omp) ##set(OFFLOAD "AMD:gfx803") #set(OFFLOAD "NVIDIA:sm_35") #set(CXX_EXTRA_FLAGS --cuda-path=/opt/cuda-10.2/) @@ -112,7 +112,7 @@ if ((DEFINED CXX_EXTRA_FLAGS) AND (NOT DEFINED CXX_EXTRA_LINK_FLAGS)) endif () # include our macros -include(register_models.cmake) +include(cmake/register_models.cmake) # register out models register_model(omp OMP OMPStream.cpp) @@ -185,8 +185,8 @@ message(STATUS "Executable : ${EXE_NAME}") # below we have all the usual CMake target setup steps -include_directories(.) -add_executable(${EXE_NAME} ${IMPL_SOURCES} main.cpp) +include_directories(src) +add_executable(${EXE_NAME} ${IMPL_SOURCES} src/main.cpp) target_link_libraries(${EXE_NAME} PUBLIC ${LINK_LIBRARIES}) target_compile_definitions(${EXE_NAME} PUBLIC ${IMPL_DEFINITIONS}) diff --git a/README.md b/README.md index 5275314..fbee03f 100644 --- a/README.md +++ b/README.md @@ -71,7 +71,7 @@ The project supports building with CMake >= 3.13.0, it can be installed without As with any CMake project, first configure the project: ```shell -> cd babelstream/src +> cd babelstream > cmake -Bbuild -H. -DMODEL= # configure the build, build type defaults to Release > cmake --build build # compile it > ./build/-stream # executable available at ./build/ @@ -85,7 +85,7 @@ There are assigned those to `RELEASE_FLAGS`, and you can override them if requir To find out what flag each model supports or requires, simply configure while only specifying the model. For example: ```shell -> cd babelstream/src +> cd babelstream > cmake -Bbuild -H. -DMODEL=ocl ... - Common Release flags are `-O3`, set RELEASE_FLAGS to override @@ -108,7 +108,7 @@ For example: OpenCL_LIBRARY (optional, default=): Path to OpenCL library, usually called libOpenCL.so ... ``` -Alternatively, refer to the [CI script](./ci-test-compile.sh), which test-compiles most of the models, and see which flags are used there. +Alternatively, refer to the [CI script](./src/ci-test-compile.sh), which test-compiles most of the models, and see which flags are used there. *It is recommended that you delete the `build` directory when you change any of the build flags.* diff --git a/src/cmake/Modules/ComputeCppCompilerChecks.cmake b/cmake/Modules/ComputeCppCompilerChecks.cmake similarity index 100% rename from src/cmake/Modules/ComputeCppCompilerChecks.cmake rename to cmake/Modules/ComputeCppCompilerChecks.cmake diff --git a/src/cmake/Modules/ComputeCppIRMap.cmake b/cmake/Modules/ComputeCppIRMap.cmake similarity index 100% rename from src/cmake/Modules/ComputeCppIRMap.cmake rename to cmake/Modules/ComputeCppIRMap.cmake diff --git a/src/cmake/Modules/FindComputeCpp.cmake b/cmake/Modules/FindComputeCpp.cmake similarity index 100% rename from src/cmake/Modules/FindComputeCpp.cmake rename to cmake/Modules/FindComputeCpp.cmake diff --git a/src/register_models.cmake b/cmake/register_models.cmake similarity index 96% rename from src/register_models.cmake rename to cmake/register_models.cmake index 12e7a3d..f180c03 100644 --- a/src/register_models.cmake +++ b/cmake/register_models.cmake @@ -134,7 +134,7 @@ macro(register_model NAME PREPROCESSOR_NAME) list(APPEND REGISTERED_MODELS "${NAME}") string(TOUPPER ${NAME} MODEL_UPPER) - list(APPEND IMPL_${MODEL_UPPER}_SOURCES "${NAME}/${ARGN}") + list(APPEND IMPL_${MODEL_UPPER}_SOURCES "src/${NAME}/${ARGN}") list(APPEND IMPL_${MODEL_UPPER}_DEFINITIONS "${PREPROCESSOR_NAME}") endmacro() @@ -142,8 +142,8 @@ endmacro() macro(load_model MODEL) if ("${MODEL}" IN_LIST REGISTERED_MODELS) string(TOLOWER "${MODEL}" MODEL_LOWER) - set(MODEL_FILE ${CMAKE_CURRENT_SOURCE_DIR}/${MODEL_LOWER}/model.cmake) - include_directories(${CMAKE_CURRENT_SOURCE_DIR}/${MODEL_LOWER}) + set(MODEL_FILE ${CMAKE_CURRENT_SOURCE_DIR}/src/${MODEL_LOWER}/model.cmake) + include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src/${MODEL_LOWER}) if (NOT EXISTS ${MODEL_FILE}) message(FATAL_ERROR "${MODEL_FILE} not found, perhaps it needs to be implemented?") endif () diff --git a/src/cmake/toolchains/arm-gcc-poky.cmake b/cmake/toolchains/arm-gcc-poky.cmake similarity index 100% rename from src/cmake/toolchains/arm-gcc-poky.cmake rename to cmake/toolchains/arm-gcc-poky.cmake diff --git a/src/cmake/toolchains/gcc-generic.cmake b/cmake/toolchains/gcc-generic.cmake similarity index 100% rename from src/cmake/toolchains/gcc-generic.cmake rename to cmake/toolchains/gcc-generic.cmake diff --git a/src/ci-test-compile.sh b/src/ci-test-compile.sh index 70303b3..3f54aaf 100755 --- a/src/ci-test-compile.sh +++ b/src/ci-test-compile.sh @@ -88,30 +88,30 @@ run_build() { ### # KOKKOS_SRC="/home/tom/Downloads/kokkos-3.3.00" # RAJA_SRC="/home/tom/Downloads/RAJA-v0.13.0" - -# GCC_CXX="/usr/bin/g++" +# +# GCC_CXX="$(which g++-10)" # CLANG_CXX="/usr/bin/clang++" - -# NVHPC_SDK_DIR="/home/tom/Downloads/nvhpc_2021_212_Linux_x86_64_cuda_11.2/install_components/Linux_x86_64/21.2/" +# +# NVHPC_SDK_DIR="/home/tom/Downloads/nvhpc_2021_219_Linux_x86_64_cuda_multi/install_components/Linux_x86_64/21.9/" # NVHPC_NVCXX="$NVHPC_SDK_DIR/compilers/bin/nvc++" -# NVHPC_NVCC="$NVHPC_SDK_DIR/cuda/11.2/bin/nvcc" -# NVHPC_CUDA_DIR="$NVHPC_SDK_DIR/cuda/11.2" +# NVHPC_NVCC="$NVHPC_SDK_DIR/cuda/11.4/bin/nvcc" +# NVHPC_CUDA_DIR="$NVHPC_SDK_DIR/cuda/11.4" # "$NVHPC_SDK_DIR/compilers/bin/makelocalrc" "$NVHPC_SDK_DIR/compilers/bin/" -x - +# # AOCC_CXX="/opt/AMD/aocc-compiler-2.3.0/bin/clang++" # AOMP_CXX="/usr/lib/aomp/bin/clang++" # OCL_LIB="/home/tom/Downloads/oclcpuexp-2020.11.11.0.04_rel/x64/libOpenCL.so" - +# # # AMD needs this rocm_path thing exported... -# export ROCM_PATH="/opt/rocm-4.0.0" -# HIP_CXX="/opt/rocm-4.0.0/bin/hipcc" -# COMPUTECPP_DIR="/home/tom/Desktop/computecpp_archive/ComputeCpp-CE-2.3.0-x86_64-linux-gnu" +# export ROCM_PATH="/opt/rocm-4.5.0" +# HIP_CXX="/opt/rocm-4.5.0/bin/hipcc" +# COMPUTECPP_DIR="/home/tom/Downloads/ComputeCpp-CE-2.7.0-x86_64-linux-gnu/" # DPCPP_DIR="/home/tom/Downloads/dpcpp_compiler" # HIPSYCL_DIR="/opt/hipsycl/cff515c/" - -# ICPX_CXX="/opt/intel/oneapi/compiler/2021.1.2/linux/bin/icpx" -# ICPC_CXX="/opt/intel/oneapi/compiler/2021.1.2/linux/bin/intel64/icpc"# TBB_LIB="/home/tom/Downloads/oneapi-tbb-2021.1.1/" - +# +# ICPX_CXX="/opt/intel/oneapi/compiler/2021.4.0/linux/bin/icpx" +# ICPC_CXX="/opt/intel/oneapi/compiler/2021.4.0/linux/bin/intel64/icpc"# TBB_LIB="/home/tom/Downloads/oneapi-tbb-2021.1.1/" +# # GCC_STD_PAR_LIB="tbb" # CLANG_STD_PAR_LIB="tbb" # GCC_OMP_OFFLOAD_AMD=false