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

Automate examples building and add new examples #5

Open
wants to merge 23 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
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
160 changes: 160 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
# Copyright (c) 2023 Aarya Chaumal
#
# SPDX-License-Identifier: BSL-1.0
# Distributed under the Boost Software License, Version 1.0. (See accompanying
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

name: Test examples on Linux

on:
push:
branches:
- main
pull_request:

jobs:
build:
runs-on: ubuntu-latest
container: stellargroup/build_env:latest

steps:
- uses: actions/checkout@v3
- name: Install HPX
shell: bash
run: |
PREFIX="${CURRENT_DIR:=$(pwd)}"

BUILD_TYPE=Release
HPX_DIR=${PREFIX}/hpx/
mkdir -p ${PREFIX}

git clone -b on_finalize https://github.com/light2802/hpx.git ${HPX_DIR}

cd ${HPX_DIR}
cmake -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
-DCMAKE_CXX_FLAGS="-std=c++17" \
-DHPX_WITH_THREAD_IDLE_RATES=ON \
-DHPX_WITH_MALLOC=tcmalloc \
-DHPX_WITH_EXAMPLES=OFF \
-DHPX_WITH_APEX=ON \
-DHPX_WITH_FETCH_ASIO=ON \
-DHPX_WITH_DYNAMIC_HPX_MAIN=OFF \
-Wdev -S ${HPX_DIR} -B ${HPX_DIR}/cmake-build/${BUILD_TYPE}

cmake --build ${HPX_DIR}/cmake-build/${BUILD_TYPE}/ --parallel
cmake --install ${HPX_DIR}/cmake-build/${BUILD_TYPE}/ --prefix ${HPX_DIR}/cmake-install/${BUILD_TYPE}

- name: Install HPXC
shell: bash
run: |
PREFIX="${CURRENT_DIR:=$(pwd)}"

BUILD_TYPE=Release
HPXC_DIR=${PREFIX}/hpxc
HPX_DIR=${PREFIX}/hpx/cmake-install/${BUILD_TYPE}/lib/cmake/HPX

mkdir -p ${PREFIX}

git clone -b hpxmp https://github.com/light2802/hpxc.git ${HPXC_DIR}

cmake \
-DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
-DHPX_DIR=${HPX_DIR} \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
-DCMAKE_CXX_FLAGS="-std=c++17" \
-Wdev -S ${HPXC_DIR} -B ${HPXC_DIR}/cmake-build/${BUILD_TYPE} \
-DCMAKE_POSITION_INDEPENDENT_CODE=ON

cmake --build ${HPXC_DIR}/cmake-build/${BUILD_TYPE}/ --parallel
cmake --install ${HPXC_DIR}/cmake-build/${BUILD_TYPE}/ --prefix ${HPXC_DIR}/cmake-install/${BUILD_TYPE}

- name: Build hpxmp
shell: bash
run: |
PREFIX="${CURRENT_DIR:=$(pwd)}"

BUILD_TYPE=Release
LLVM_DIR=${PREFIX}/llvm-project
LLVM_VERSION=16.0.6
OMP_DIR=${LLVM_DIR}/openmp
HPX_DIR=${PREFIX}/hpx/cmake-install/${BUILD_TYPE}/lib/cmake/HPX
HPXC_DIR=${PREFIX}/hpxc
PROJECT=hpxmp
BUILD_DIR=${OMP_DIR}/cmake-build-${PROJECT}/${BUILD_TYPE}/

mkdir -p ${PREFIX}

git clone --depth=1 -b hpxmp-v16 https://github.com/light2802/llvm-project.git ${LLVM_DIR}

cmake \
-DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
-DCMAKE_VERBOSE_MAKEFILE=ON \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
-DCMAKE_CXX_FLAGS="-std=c++17" \
-DHPX_DIR=${HPX_DIR} \
-DWITH_HPXC=ON \
-DHPXC_DIR=${HPXC_DIR} \
-DOPENMP_ENABLE_LIBOMPTARGET=OFF \
-DLIBOMP_OMPD_SUPPORT=OFF \
-DLIBOMP_USE_STDCPPLIB:BOOL=TRUE \
-DCMAKE_INSTALL_PREFIX=${OMP_DIR}/cmake-install-${PROJECT}/${BUILD_TYPE} \
-Wdev -S ${OMP_DIR} -B ${BUILD_DIR}

cmake --build ${BUILD_DIR} --parallel
cmake --install ${BUILD_DIR}/ --prefix ${OMP_DIR}/cmake-install-${PROJECT}/${BUILD_TYPE}

# - name: Build OMP examples
# shell: bash
# run: |
# PREFIX="${CURRENT_DIR:=$(pwd)}"

# EXAMPLE_PATH=${PREFIX}/running_examples
# BUILD_TYPE=Debug
# PROJECT=examples

# mkdir -p ${PREFIX}

# rm -rf ${EXAMPLE_PATH}/cmake-build-omp

# cmake \
# -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
# -DCMAKE_VERBOSE_MAKEFILE=ON \
# -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
# -DCMAKE_CXX_FLAGS="-std=c++17 -fopenmp" \
# -DCMAKE_CXX_COMPILER=g++ \
# -DCMAKE_C_COMPILER=gcc \
# -DHPX_DIR=${HPX_DIR} \
# -DOMP_LIB_PATH=${PREFIX}/llvm-project/openmp/cmake-install-omp/${BUILD_TYPE}/lib/libomp.so \
# -Wdev -S ${EXAMPLE_PATH} -B ${EXAMPLE_PATH}/cmake-build-omp/${BUILD_TYPE}

# cmake --build ${EXAMPLE_PATH}/cmake-build-omp/${BUILD_TYPE}/ --parallel
# cmake --install ${EXAMPLE_PATH}/cmake-build-omp/${BUILD_TYPE}/ --prefix ${EXAMPLE_PATH}/cmake-install-omp/${BUILD_TYPE}

- name: Build HPXMP examples
shell: bash
env:
CC: gcc
CXX: g++
run: |
PREFIX="${CURRENT_DIR:=$(pwd)}"

EXAMPLE_PATH=${PREFIX}/running_examples
BUILD_TYPE=Release
HPX_DIR=${PREFIX}/hpx/cmake-install/${BUILD_TYPE}/lib/cmake/HPX

mkdir -p ${PREFIX}

rm -rf ${EXAMPLE_PATH}/cmake-build-hpxmp

cmake \
-DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
-DCMAKE_VERBOSE_MAKEFILE=ON \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
-DCMAKE_CXX_FLAGS="-std=c++17 -fopenmp" \
-DHPX_DIR=${HPX_DIR} \
-DWITH_HPXC=ON \
-DOMP_LIB_PATH=${PREFIX}/llvm-project/openmp/cmake-install-hpxmp/${BUILD_TYPE}/lib/libomp.so \
-Wdev -S ${EXAMPLE_PATH} -B ${EXAMPLE_PATH}/cmake-build-hpxmp/${BUILD_TYPE}

cmake --build ${EXAMPLE_PATH}/cmake-build-hpxmp/${BUILD_TYPE}/ --parallel
cmake --install ${EXAMPLE_PATH}/cmake-build-hpxmp/${BUILD_TYPE}/ --prefix ${EXAMPLE_PATH}/cmake-install-hpxmp/${BUILD_TYPE}
165 changes: 165 additions & 0 deletions .github/workflows/test_windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
# Copyright c 2023 Aarya Chaumal
#
# SPDX-License-Identifier: BSL-1.0
# Distributed under the Boost Software License, Version 1.0. See accompanying
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt

name: Test examples on Windows

on:
push:
branches:
- main
pull_request:

jobs:
build:
runs-on: windows-latest

steps:
- uses: actions/checkout@v3
- uses: jwlawson/actions-setup-cmake@v1.14
with:
cmake-version: "3.22.x"
# - name: Install deps
# shell: bash
# run: |
# perl -MCPAN -e "install Pod::Usage"

- name: Install dependencies
run: |
md C:\projects
$client = new-object System.Net.WebClient
$client.DownloadFile("https://rostam.cct.lsu.edu/download/builder/vcpkg-export-hpx-dependencies-2022.7z","C:\projects\vcpkg-export-hpx-dependencies.7z")
7z x C:\projects\vcpkg-export-hpx-dependencies.7z -y -oC:\projects\vcpkg
perl -MCPAN -e "install Pod::Usage"

- name: Install HPX
shell: bash
run: |
PREFIX="${CURRENT_DIR:=$(pwd)}"

BUILD_TYPE=Release
HPX_DIR=${PREFIX}/hpx/
rm -rf ${HPX_DIR}
#mkdir -p ${PREFIX}

git clone -b on_finalize https://github.com/light2802/hpx.git ${HPX_DIR}

cd ${HPX_DIR}
cmake -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
-DCMAKE_TOOLCHAIN_FILE="C:/projects/vcpkg/scripts/buildsystems/vcpkg.cmake" \
-DHPX_WITH_THREAD_IDLE_RATES=ON \
-DHPX_WITH_EXAMPLES=OFF \
-DHPX_WITH_FETCH_ASIO=ON \
-DHPX_WITH_DYNAMIC_HPX_MAIN=OFF \
-Wdev -S ${HPX_DIR} -B ${HPX_DIR}/cmake-build/${BUILD_TYPE} \
-G'Visual Studio 17 2022'

cmake --build ${HPX_DIR}/cmake-build/${BUILD_TYPE}/ --parallel

- name: Install HPXC
shell: bash
run: |
PREFIX="${CURRENT_DIR:=$(pwd)}"

BUILD_TYPE=Release
HPXC_DIR=${PREFIX}/hpxc
HPX_DIR=${PREFIX}/hpx/cmake-build/${BUILD_TYPE}/lib/cmake/HPX

mkdir -p ${PREFIX}

git clone -b hpxmp https://github.com/light2802/hpxc.git ${HPXC_DIR}

cmake \
-DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
-DCMAKE_TOOLCHAIN_FILE="C:/projects/vcpkg/scripts/buildsystems/vcpkg.cmake" \
-DHPX_DIR=${HPX_DIR} \
-Wdev -S ${HPXC_DIR} -B ${HPXC_DIR}/cmake-build/${BUILD_TYPE} \
-DCMAKE_POSITION_INDEPENDENT_CODE=ON

cmake --build ${HPXC_DIR}/cmake-build/${BUILD_TYPE}/ --parallel
#cmake --install ${HPXC_DIR}/cmake-build/${BUILD_TYPE}/ --prefix ${HPXC_DIR}/cmake-install/${BUILD_TYPE}

- name: Build hpxmp
run: |
$PREFIX = pwd

$BUILD_TYPE = "Release"
$LLVM_DIR = "$($PREFIX)/llvm-project"
$LLVM_VERSION = "16.0.6"
$OMP_DIR = "$($LLVM_DIR)/openmp"
$HPX_DIR = "$($PREFIX)/hpx/cmake-build/$($BUILD_TYPE)/lib/cmake/HPX"
$HPXC_DIR = "$($PREFIX)/hpxc"
$PROJECT = "hpxmp"
$BUILD_DIR= "$($OMP_DIR)/cmake-build-$($PROJECT)/$($BUILD_TYPE)/"

pip install psutil

git clone --depth=1 -b hpxmp-v16 https://github.com/light2802/llvm-project.git $($LLVM_DIR)

cmake `
-DCMAKE_BUILD_TYPE=$($BUILD_TYPE) `
-DHPX_DIR="$($HPX_DIR)" `
-DWITH_HPXC=ON `
-DHPXC_DIR="$($HPXC_DIR)" `
-DOPENMP_ENABLE_LIBOMPTARGET=OFF `
-DLIBOMP_OMPD_SUPPORT=OFF `
-DLIBOMP_USE_STDCPPLIB:BOOL=TRUE `
-DCMAKE_TOOLCHAIN_FILE="C:/projects/vcpkg/scripts/buildsystems/vcpkg.cmake" `
-Wdev -S $($OMP_DIR) -B $($BUILD_DIR) `
-G'Visual Studio 17 2022'

cmake --build $($BUILD_DIR) --parallel
#cmake --install $($BUILD_DIR) --prefix "$($OMP_DIR)/cmake-install-$($PROJECT)/$($BUILD_TYPE)"

# - name: Build OMP examples
# shell: bash
# run: |
# PREFIX="${CURRENT_DIR:=$(pwd)}"

# EXAMPLE_PATH=${PREFIX}/running_examples
# BUILD_TYPE=Debug
# PROJECT=examples

# mkdir -p ${PREFIX}

# rm -rf ${EXAMPLE_PATH}/cmake-build-omp

# cmake \
# -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
# -DCMAKE_VERBOSE_MAKEFILE=ON \
# -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
# -DCMAKE_CXX_FLAGS="-std=c++17 -fopenmp" \
# -DCMAKE_CXX_COMPILER=g++ \
# -DCMAKE_C_COMPILER=gcc \
# -DHPX_DIR=${HPX_DIR} \
# -DOMP_LIB_PATH=${PREFIX}/llvm-project/openmp/cmake-install-omp/${BUILD_TYPE}/lib/libomp.so \
# -Wdev -S ${EXAMPLE_PATH} -B ${EXAMPLE_PATH}/cmake-build-omp/${BUILD_TYPE}

# cmake --build ${EXAMPLE_PATH}/cmake-build-omp/${BUILD_TYPE}/ --parallel
# cmake --install ${EXAMPLE_PATH}/cmake-build-omp/${BUILD_TYPE}/ --prefix ${EXAMPLE_PATH}/cmake-install-omp/${BUILD_TYPE}

- name: Build HPXMP examples
shell: bash
run: |
PREFIX="${CURRENT_DIR:=$(pwd)}"

EXAMPLE_PATH=${PREFIX}/running_examples
BUILD_TYPE=Release
HPX_DIR=${PREFIX}/hpx/cmake-install/${BUILD_TYPE}/lib/cmake/HPX

mkdir -p ${PREFIX}

rm -rf ${EXAMPLE_PATH}/cmake-build-hpxmp

cmake \
-DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
-DCMAKE_CXX_FLAGS="-fopenmp" \
-DHPX_DIR=${HPX_DIR} \
-DWITH_HPXC=ON \
-DOMP_LIB_PATH=${PREFIX}/llvm-project/openmp/cmake-build-hpxmp/${BUILD_TYPE}/lib/libomp.so \
-Wdev -S ${EXAMPLE_PATH} -B ${EXAMPLE_PATH}/cmake-build-hpxmp/${BUILD_TYPE}

cmake --build ${EXAMPLE_PATH}/cmake-build-hpxmp/${BUILD_TYPE}/ --parallel
#cmake --install ${EXAMPLE_PATH}/cmake-build-hpxmp/${BUILD_TYPE}/ --prefix ${EXAMPLE_PATH}/cmake-install-hpxmp/${BUILD_TYPE}
36 changes: 36 additions & 0 deletions build-examples-new.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/bash

# Copyright (c) 2023 R. Tohid (@rtohid)
#
# SPDX-License-Identifier: BSL-1.0
# Distributed under the Boost Software License, Version 1.0. (See accompanying
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

module load gcc/12.3.0 boost

CURRENT_DIR=$1
PREFIX="${CURRENT_DIR:=$(pwd)}"

EXAMPLE_PATH=${PREFIX}/hpx_example
BUILD_TYPE=Debug
HPX_DIR=${PREFIX}/hpx/cmake-install/${BUILD_TYPE}/lib64/cmake/HPX

mkdir -p ${PREFIX}

rm -rf ${EXAMPLE_PATH}/cmake-build-hpxmp

cmake \
-DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
-DCMAKE_VERBOSE_MAKEFILE=ON \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
-DCMAKE_CXX_FLAGS="-std=c++17 -fopenmp" \
-DCMAKE_CXX_COMPILER=g++ \
-DCMAKE_C_COMPILER=gcc \
-DHPX_DIR=${HPX_DIR} \
-DWITH_HPXC=ON \
-DOMP_LIB_PATH=${PREFIX}/llvm-project/openmp/cmake-install-hpxmp/${BUILD_TYPE}/lib/libomp.so \
-Wdev -S ${EXAMPLE_PATH} -B ${EXAMPLE_PATH}/cmake-build-hpxmp/${BUILD_TYPE}

cmake --build ${EXAMPLE_PATH}/cmake-build-hpxmp/${BUILD_TYPE}/ --parallel
cmake --install ${EXAMPLE_PATH}/cmake-build-hpxmp/${BUILD_TYPE}/ --prefix ${EXAMPLE_PATH}/cmake-install-hpxmp/${BUILD_TYPE}

2 changes: 1 addition & 1 deletion build-hpxmp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ BUILD_DIR=${OMP_DIR}/cmake-build-${PROJECT}/${BUILD_TYPE}/
mkdir -p ${PREFIX}

if [ ! -d ${LLVM_DIR} ]; then
git clone --depth=1 -b hpxc git@github.com:light2802/llvm-project.git ${LLVM_DIR}
git clone --depth=1 -b hpxmp-v16 https://github.com/light2802/llvm-project.git ${LLVM_DIR}
fi

rm -rf ${BUILD_DIR}
Expand Down
23 changes: 23 additions & 0 deletions hpx_example/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Copyright (c) 2023 R. Tohid (@rtohid)
#
# SPDX-License-Identifier: BSL-1.0
# Distributed under the Boost Software License, Version 1.0. (See accompanying
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

cmake_minimum_required(VERSION 3.18)

project(hpxMP C CXX)
option(WITH_HPXC "Use HPX threading system." OFF)
if (WITH_HPXC)
find_package(HPX REQUIRED)
add_definitions(-DHPXC)
endif()

set(CMAKE_CXX_FLAGS "-fopenmp")

add_executable(hello_world hello.cpp)
if (WITH_HPXC)
target_link_libraries(hello_world ${OMP_LIB_PATH} pthread HPX::hpx HPX::wrap_main)
else()
target_link_libraries(hello_world ${OMP_LIB_PATH} pthread)
endif()
Loading