Skip to content
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
71 changes: 71 additions & 0 deletions .github/workflows/CMakeBuildUbuntu.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: Building For Ubuntu 🐧

on:
push:
branches:
- master
pull_request:
branches:
- master

env:
BUILD_TYPE: Release
packageName: hipims-cuda-amd64.deb

jobs:
BuildForUbuntu:
name: 🐧 Build for Ubuntu
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1

- name: ♻️ Get Nvdia Driver Cache
uses: Jimver/cuda-toolkit@v0.2.18
id: cuda-toolkit
with:
method: network
sub-packages: '["nvcc"]'

- name: 🏗️ Configure CMake
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}

- name: 🛠️ Build
run: |
cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} -j 4

- name: 🗄️ Set up Debian Package
run: |
mkdir -p debian/usr/local/bin
cp release/bin/* debian/usr/local/bin/

- name: 🔨 Build Debian Package
run: |
dpkg-deb --build debian ${{env.packageName}}

- name: ⬆️ Upload deb package
uses: actions/upload-artifact@v4
with:
name: debArtifact
path: "${{github.workspace}}/${{env.packageName}}"

ReleaseArtifact:
name: 🚀 Release Project
runs-on: ubuntu-latest
needs: BuildForUbuntu
steps:
- name: ⬇️ Download deb
uses: actions/download-artifact@v4
with:
name: debArtifact

- name: 📦 Add binaries to Release Tag
uses: softprops/action-gh-release@v2
with:
tag_name: Continuous
files: |
${{env.packageName}}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
109 changes: 109 additions & 0 deletions .github/workflows/CMakeBuildWindows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
name: Building For Windows 🪟

on:
push:
branches:
- master
pull_request:
branches:
- master

env:
BUILD_TYPE: Release

jobs:
BuildForWindows:
name: 🪟 Build for Windows
runs-on: windows-latest
env:
CUDA_PATH: "C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v12.6"
CUDA_PATH_BIN: "C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v12.6\\bin"
CUDA_PATH_V12_6: "C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v12.6"
CUDA_PATH_VX_Y: "C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v12.6"

NVIDA_DRIVER_URL: "https://developer.download.nvidia.com/compute/cuda/12.6.2/local_installers/cuda_12.6.2_560.94_windows.exe"
NVIDA_DRIVER_FILE_NAME: "cuda_12.6.2_560.94_windows.exe"
NVIDA_INSTALL_ARGS: "-s nvcc_12.6 visual_studio_integration_12.6 cudart_12.6"

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1

- name: ♻️ Get Nvdia Driver Cache
id: cache-nvdia
uses: actions/cache@v4
with:
path: nvidia_toolkit_cache
key: nvidia-toolkit-${{ env.NVIDA_DRIVER_FILE_NAME }}

- name: ⬇️ Download Nvidia Driver
if: steps.cache-nvdia.outputs.cache-hit != 'true'
run: Invoke-WebRequest -Uri $env:NVIDA_DRIVER_URL -OutFile $env:NVIDA_DRIVER_FILE_NAME

- name: ⚙️ Install Nvidia Driver
if: steps.cache-nvdia.outputs.cache-hit != 'true'
run: |
Start-Process -FilePath $env:NVIDA_DRIVER_FILE_NAME -ArgumentList $env:NVIDA_INSTALL_ARGS -Wait -NoNewWindow

- name: 🗄️Setup for Cache Nvidia Driver
if: steps.cache-nvdia.outputs.cache-hit != 'true'
run: |
mkdir -p "nvidia_toolkit_cache"
xcopy "C:\Program Files\NVIDIA GPU Computing Toolkit\" "nvidia_toolkit_cache\" /s /e /y

- name: 💾 Cache Nvidia Driver
id: cache-primes-save
if: steps.cache-nvdia.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: nvidia_toolkit_cache
key: nvidia-toolkit-${{ env.NVIDA_DRIVER_FILE_NAME }}

- name: 🔄 Restore NVIDIA Toolkit from cache
if: steps.cache-nvdia.outputs.cache-hit == 'true'
run: |
xcopy "nvidia_toolkit_cache\" "C:\Program Files\NVIDIA GPU Computing Toolkit\" /s /e /y
xcopy "nvidia_toolkit_cache\CUDA\v12.6\extras\visual_studio_integration\MSBuildExtensions\" "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Microsoft\VC\v170\BuildCustomizations\" /s /e /y

- shell: bash
name: 🛠️ Add Nvidia to path
run: |
echo "CUDA_PATH=$CUDA_PATH" >> $GITHUB_ENV
echo "CUDA_PATH_V12_6=$CUDA_PATH_V12_6" >> $GITHUB_ENV
echo "CUDA_PATH_VX_Y=$CUDA_PATH_VX_Y" >> $GITHUB_ENV
echo "$CUDA_PATH_BIN" >> $GITHUB_PATH

- name: 🏗️ Configure CMake
run: |
cmake -B ${{github.workspace}}\build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}

- name: 🛠️ Build
run: cmake --build ${{github.workspace}}\build --config ${{env.BUILD_TYPE}} -j 4

- name: ⬆️ Upload Exe File
uses: actions/upload-artifact@v4
with:
name: binariesArtifact
path: "${{github.workspace}}\\release\\bin\\Release"

ReleaseArtifact:
name: 🚀 Release Project
runs-on: ubuntu-latest
needs: BuildForWindows
steps:
- name: ⬇️ Download exe
uses: actions/download-artifact@v4
with:
name: binariesArtifact

- name: 📦 Add binaries to Release Tag
uses: softprops/action-gh-release@v2
with:
tag_name: Continuous
files: |
hipims-flood.exe
hipims-flood-mgpus.exe
hipims-landslide.exe
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
30 changes: 30 additions & 0 deletions .github/workflows/actionCacheClear.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Clear cache

on:
workflow_dispatch:

permissions:
actions: write

jobs:
clear-cache:
runs-on: ubuntu-latest
steps:
- name: Clear cache
uses: actions/github-script@v6
with:
script: |
console.log("About to clear")
const caches = await github.rest.actions.getActionsCacheList({
owner: context.repo.owner,
repo: context.repo.repo,
})
for (const cache of caches.data.actions_caches) {
console.log(cache)
github.rest.actions.deleteActionsCacheById({
owner: context.repo.owner,
repo: context.repo.repo,
cache_id: cache.id,
})
}
console.log("Clear completed")
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/build/
/release/
/debian/usr/
*.deb
22 changes: 13 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,27 +1,31 @@
cmake_minimum_required(VERSION 2.6)
#project name
project(HiPIMs)
cmake_minimum_required(VERSION 3.10)

find_package(CUDA)
project(HiPIMs LANGUAGES CXX CUDA)

set(CMAKE_CUDA_STANDARD 14)
set(CMAKE_CUDA_STANDARD_REQUIRED ON)
set(CMAKE_CUDA_ARCHITECTURES 80)
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} --extended-lambda")
set(CMAKE_CUDA_SEPARABLE_COMPILATION ON)

if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Debug)
endif()

# Enable debug symbols across all platforms
IF(WIN32)
set(PLATFORM_CXX_FLAGS /Zi)
set(CUDA_SEPARABLE_COMPILATION ON)
set(CUDA_NVCC_FLAGS -arch=sm_35;--expt-extended-lambda)
ENDIF(WIN32)

IF(UNIX)
set(PLATFORM_CXX_FLAGS "-pthread -std=c++11 -O3")
#set(CUDA_SEPARABLE_COMPILATION ON)
set(CUDA_NVCC_FLAGS -arch=sm_35;--expt-extended-lambda)
ENDIF(UNIX)

list(APPEND CMAKE_CXX_FLAGS ${PLATFORM_CXX_FLAGS})

message("CXX Flags: " ${CMAKE_CXX_FLAGS})
message("NVCC Flags: " ${CUDA_NVCC_FLAGS})


add_subdirectory(lib)
add_subdirectory(apps/cudaFloodSolver)
add_subdirectory(apps/cudaMultiGPUsFloodSolver)
Expand Down
4 changes: 2 additions & 2 deletions apps/cudaFloodSolver/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 2.8)
cmake_minimum_required(VERSION 3.10)

set(EXE hipims-flood)
set(SRCS cuda_flood_solver.cu)
Expand All @@ -17,7 +17,7 @@ list(REMOVE_DUPLICATES GC_INCLUDE_DIRS)

include_directories(${GC_INCLUDE_DIRS})

cuda_add_executable(${EXE} ${SRCS})
add_executable(${EXE} ${SRCS})
add_dependencies(${EXE} lib cuda_lib)

#set (CUDA_NVCC_FLAGS "-arch=sm_20")
Expand Down
4 changes: 2 additions & 2 deletions apps/cudaIntegratedShallowFlowSolver/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 2.8)
cmake_minimum_required(VERSION 3.10)

set(EXE hipims-landslide)
set(SRCS cuda_integrated_shallow_flow_solver.cu)
Expand All @@ -17,7 +17,7 @@ list(REMOVE_DUPLICATES GC_INCLUDE_DIRS)

include_directories(${GC_INCLUDE_DIRS})

cuda_add_executable(${EXE} ${SRCS})
add_executable(${EXE} ${SRCS})
add_dependencies(${EXE} lib cuda_lib)

#set (CUDA_NVCC_FLAGS "-arch=sm_20")
Expand Down
4 changes: 2 additions & 2 deletions apps/cudaMultiGPUsFloodSolver/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 2.8)
cmake_minimum_required(VERSION 3.10)

set(EXE hipims-flood-mgpus)
set(SRCS cuda_mgpus_flood_solver.cu)
Expand All @@ -17,7 +17,7 @@ list(REMOVE_DUPLICATES GC_INCLUDE_DIRS)

include_directories(${GC_INCLUDE_DIRS})

cuda_add_executable(${EXE} ${SRCS})
add_executable(${EXE} ${SRCS})
add_dependencies(${EXE} lib cuda_lib)

#set (CUDA_NVCC_FLAGS "-arch=sm_20")
Expand Down
16 changes: 16 additions & 0 deletions debian/DEBIAN/control
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Package: hipims-cuda
Version: 1.0
Section: utils
Priority: optional
Architecture: amd64
Depends: libc6 (>= 2.30)
Maintainer: HIPIMS
Description: HiPIMS is a high-performance GPU-based flood simulation system.
HiPIMS standards for High-Performance Integrated hydrodynamic Modelling System.
It uses state-of-art numerical schemes (Godunov-type finite volume) to solve the
2D shallow water equations for flood simulations. To support high-resolution flood
simulations, HiPIMS is implemented on multiple GPUs (Graphics Processing Units)
using CUDA/C++ languages to achieve high-performance computing. Since HiPIMS has
a modular and flexible structure, it has great potential to be further developed
for other applications in hydrological science as long as the problem can be solved
on a uniform rectangular grid.
4 changes: 2 additions & 2 deletions lib/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 2.8)
cmake_minimum_required(VERSION 3.10)

# nvcc flags

Expand Down Expand Up @@ -28,6 +28,6 @@ else()
include_directories(${GC_INCLUDE_DIRS})
add_library(lib STATIC ${gc_srcs})
#cuda_add_library(cuda_lib STATIC ${gc_cuda_srcs})
cuda_add_library(cuda_lib STATIC ${gc_cuda_srcs})
add_library(cuda_lib STATIC ${gc_cuda_srcs})

endif()