From 63a5d6fb5bf8e96c89142deb287d3824229a3530 Mon Sep 17 00:00:00 2001 From: Thilina Ratnayaka Date: Wed, 20 Nov 2024 17:12:58 +0000 Subject: [PATCH 1/4] Install headers in codegen/ to ${PREFIX}/install --- .codecov.yml | 7 ++++--- .gitignore | 8 ++++---- Makefile | 10 +++++----- cmake/CodeGen.cmake | 14 ++++++++++---- 4 files changed, 23 insertions(+), 16 deletions(-) diff --git a/.codecov.yml b/.codecov.yml index a3d94ccef..400c3ab84 100644 --- a/.codecov.yml +++ b/.codecov.yml @@ -19,9 +19,10 @@ ignore: - scripts - include/occa/scripts # Auto-generated files - - include/occa/core/kernelOperators.hpp_codegen - - src/core/kernelOperators.cpp_codegen - - src/occa/internal/utils/runFunction.cpp_codegen + - include/codegen/kernelOperators.cpp_codegen + - include/codegen/kernelOperators.hpp_codegen + - include/codegen/macros.hpp_codegen + - include/codegen/runFunction.cpp_codegen # Exception is not tracked properly - src/utils/exception.cpp # Modes that can't be tested with CI diff --git a/.gitignore b/.gitignore index 7bcc9ce65..252dffe86 100644 --- a/.gitignore +++ b/.gitignore @@ -21,10 +21,10 @@ opt /.compiledDefines /include/occa/defines/compiledDefines.hpp /include/occa/scripts -/include/occa/core/kernelOperators.hpp_codegen -/src/core/kernelOperators.cpp_codegen -/src/occa/internal/utils/runFunction.cpp_codegen -/include/occa/defines/macros.hpp_codegen +/include/codegen/kernelOperators.cpp_codegen +/include/codegen/kernelOperators.hpp_codegen +/include/codegen/macros.hpp_codegen +/include/codegen/runFunction.cpp_codegen # Binaries generated to fetch compiler information /scripts/compiler/compilerSupportsMPI diff --git a/Makefile b/Makefile index d2ae06869..994437d44 100644 --- a/Makefile +++ b/Makefile @@ -80,14 +80,14 @@ else endif #================================================= -PLACE_GENERATED_CODES := $(shell mkdir -p $(OCCA_DIR)/include/occa/core/codegen | \ +PLACE_GENERATED_CODES := $(shell mkdir -p $(OCCA_DIR)/include/codegen | \ mkdir -p $(OCCA_DIR)/src/core/codegen | \ mkdir -p $(OCCA_DIR)/src/occa/internal/utils/codegen | \ mkdir -p $(OCCA_DIR)/include/occa/defines/codegen) -PLACE_GENERATED_CODES := $(shell cp $(OCCA_DIR)/scripts/codegen/kernelOperators.hpp_codegen.in $(OCCA_DIR)/include/occa/core/codegen/kernelOperators.hpp_codegen | \ - cp $(OCCA_DIR)/scripts/codegen/kernelOperators.cpp_codegen.in $(OCCA_DIR)/src/core/codegen/kernelOperators.cpp_codegen | \ - cp $(OCCA_DIR)/scripts/codegen/runFunction.cpp_codegen.in $(OCCA_DIR)/src/occa/internal/utils/codegen/runFunction.cpp_codegen | \ - cp $(OCCA_DIR)/scripts/codegen/macros.hpp_codegen.in $(OCCA_DIR)/include/occa/defines/codegen/macros.hpp_codegen) +PLACE_GENERATED_CODES := $(shell cp $(OCCA_DIR)/scripts/codegen/kernelOperators.cpp_codegen.in $(OCCA_DIR)/include/codegen/kernelOperators.cpp_codegen | \ + cp $(OCCA_DIR)/scripts/codegen/kernelOperators.hpp_codegen.in $(OCCA_DIR)/include/codegen/kernelOperators.hpp_codegen | \ + cp $(OCCA_DIR)/scripts/codegen/macros.hpp_codegen.in $(OCCA_DIR)/include/codegen/macros.hpp_codegen | \ + cp $(OCCA_DIR)/scripts/codegen/runFunction.cpp_codegen.in $(OCCA_DIR)/include/codegen/runFunction.cpp_codegen) #---[ Compile Library ]--------------------------- # Setup compiled defines and force rebuild if defines changed diff --git a/cmake/CodeGen.cmake b/cmake/CodeGen.cmake index a771fc55b..95bc9bb45 100644 --- a/cmake/CodeGen.cmake +++ b/cmake/CodeGen.cmake @@ -28,10 +28,16 @@ else() endif() endif() -# Set installtion of files required in header +# Set installtion of files required in header install( - FILES ${OCCA_BUILD_DIR}/include/codegen/kernelOperators.hpp_codegen - DESTINATION include/occa/core/codegen) + FILES ${OCCA_BUILD_DIR}/include/codegen/kernelOperators.cpp_codegen + DESTINATION include/codegen) +install( + FILES ${OCCA_BUILD_DIR}/include/codegen/kernelOperators.hpp_codegen + DESTINATION include/codegen) install( FILES ${OCCA_BUILD_DIR}/include/codegen/macros.hpp_codegen - DESTINATION include/occa/defines/codegen) + DESTINATION include/codegen) +install( + FILES ${OCCA_BUILD_DIR}/include/codegen/runFunction.cpp_codegen + DESTINATION include/codegen) From 56d6897ade9c4e1f50cf7cfbb2f8a4a70e9ce36a Mon Sep 17 00:00:00 2001 From: Thilina Ratnayaka Date: Wed, 20 Nov 2024 21:21:39 +0000 Subject: [PATCH 2/4] Add a missing include to include/occa.hpp --- include/occa.hpp | 1 + 1 file changed, 1 insertion(+) diff --git a/include/occa.hpp b/include/occa.hpp index bed222794..ff41c76cc 100644 --- a/include/occa.hpp +++ b/include/occa.hpp @@ -7,5 +7,6 @@ #include #include #include +#include #endif From d36ba3adbc8e909f9cc0bd8b0414d435bc3cc3c0 Mon Sep 17 00:00:00 2001 From: Thilina Ratnayaka Date: Wed, 20 Nov 2024 23:04:06 +0000 Subject: [PATCH 3/4] Set OCCA_INSTALL_DIR in GitHub CI runs --- .github/workflows/build.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5884add6c..db987857a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -84,6 +84,9 @@ jobs: uses: mxschmitt/action-tmate@v3.13 if: ${{ inputs.debug_enabled }} + - name: Set OCCA install directory + run: echo "OCCA_INSTALL_DIR=${PWD}/install" >> ${GITHUB_ENV} + - name: add oneAPI to apt if: ${{ matrix.useoneAPI }} shell: bash @@ -104,14 +107,14 @@ jobs: - name: Compiler info if: ${{ !matrix.useCMake }} - run: make -j 16 info + run: make PREFIX=${{ env.OCCA_INSTALL_DIR }} -j 16 info - name: CMake configure if: ${{ matrix.useCMake && !matrix.useoneAPI}} run: | cmake -S . -B build \ -DCMAKE_BUILD_TYPE="RelWithDebInfo" \ - -DCMAKE_INSTALL_PREFIX=install \ + -DCMAKE_INSTALL_PREFIX=${{ env.OCCA_INSTALL_DIR }} \ -DCMAKE_C_COMPILER=${CC} \ -DCMAKE_CXX_COMPILER=${CXX} \ -DCMAKE_Fortran_COMPILER=${FC} \ @@ -128,7 +131,7 @@ jobs: source /opt/intel/oneapi/setvars.sh cmake -S . -B build \ -DCMAKE_BUILD_TYPE="RelWithDebInfo" \ - -DCMAKE_INSTALL_PREFIX=install \ + -DCMAKE_INSTALL_PREFIX=${{ env.OCCA_INSTALL_DIR }} \ -DCMAKE_C_COMPILER=${CC} \ -DCMAKE_CXX_COMPILER=${CXX} \ -DCMAKE_Fortran_COMPILER=${FC} \ From 6e1eb0499209966dbcdd7a6f83cfc8e81ff5d579 Mon Sep 17 00:00:00 2001 From: Thilina Ratnayaka Date: Thu, 21 Nov 2024 18:46:47 +0000 Subject: [PATCH 4/4] Install library in GitHub CI before running tests --- .github/workflows/build.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index db987857a..0fce65efd 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -139,21 +139,21 @@ jobs: -DOCCA_ENABLE_EXAMPLES=ON \ -DOCCA_ENABLE_FORTRAN=${OCCA_FORTRAN_ENABLED} - - name: CMake build + - name: CMake build and install if: ${{ matrix.useCMake && !matrix.useoneAPI}} run: | - cmake --build build --parallel 16 + cmake --build build --target install --parallel 16 - - name: CMake build + - name: CMake build and install if: ${{ matrix.useCMake && matrix.useoneAPI}} env: OCCA_CC: ${{ matrix.CC }} OCCA_CXX: ${{ matrix.CXX }} run: | source /opt/intel/oneapi/setvars.sh - cmake --build build --parallel 16 + cmake --build build --target install --parallel 16 - - name: Compile library + - name: Compile library and install if: ${{ !matrix.useCMake }} run: make -j 16