Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
77e1a8a
Add .gitignore file
ptheywood Apr 19, 2022
daa4c39
Add CMake-based build-system, using components from FLAMEGPU/FLAMEGPU2
ptheywood Apr 19, 2022
a2fc5ae
Add MIT Licence
ptheywood Apr 19, 2022
5d0fb23
Add CI builds via GitHub Actions
ptheywood Apr 19, 2022
a6bdff5
Reduce windows CI builds to 1
ptheywood Apr 19, 2022
15ed9bd
Add CI badges to the readme
ptheywood Apr 19, 2022
ae50721
Add VERBOSE_PTXAS Cmake option for verbose ptxas output
ptheywood Apr 19, 2022
13f9b8e
Add -lDL via CMake
ptheywood Apr 19, 2022
e0cecb1
Initial, incomplete benchmark
ptheywood Apr 19, 2022
8af3296
Minor benchmark tweaks, still unfinished
ptheywood Apr 19, 2022
1e271c3
Fix launching of input kernel
ptheywood Apr 20, 2022
832f030
Add CLI11-based CLI parsing + fix a few issues
ptheywood Apr 20, 2022
ab3468d
Add a readme for the benchmark subproject
ptheywood Apr 20, 2022
121679f
Add basic csv output to stdout
ptheywood Apr 20, 2022
0c5b66f
Slightly nicer CSV handling
ptheywood Apr 20, 2022
8bb8923
Move OutputCSV to it's own file
ptheywood Apr 20, 2022
99c39ad
std::string overloads for nvtx.h
ptheywood Apr 20, 2022
ac247e1
Less manual NVTX ranges
ptheywood Apr 20, 2022
2050b8d
Tidying up, 2 levels of verbosity
ptheywood Apr 20, 2022
1343328
Use modern c++ seeded prng (MT)
ptheywood Apr 20, 2022
79fbf78
Update problem matcher for nvcc device warnings
ptheywood Apr 20, 2022
ddc2b18
disable CUDA 11.6 CI for now, while 3rd party warning breaks Werror
ptheywood Apr 20, 2022
f720ebc
Rename curve.h to curve.cuh
ptheywood Apr 20, 2022
6b7830e
Move curve.cu(h) into curve subdirectories
ptheywood Apr 20, 2022
50aed5d
Add src dirs
ptheywood Apr 20, 2022
055bf0c
Direct, unmodified curve.cuh/curve.cu from FLAMEGPU/FLAMEGPU2 v2.0.0-…
ptheywood Apr 20, 2022
0a5f0d2
Replace FLAMEGPU specfic bits of curve
ptheywood Apr 20, 2022
5973e91
Update example project to use recent flamegpu curve
ptheywood Apr 21, 2022
005dab0
Update abm benchmark to use recent curve and add crude validation
ptheywood Apr 21, 2022
93e39a9
Add unmapping to example
ptheywood Apr 21, 2022
8ba5a14
Rename benchmark -> abm-benchmark, update readmes
ptheywood Apr 21, 2022
31b1380
Change default repetitions to 1
ptheywood Apr 21, 2022
7d608e9
Fix nvtx marker name
ptheywood Apr 21, 2022
d03fc5d
Switch to circles model implementation
ptheywood Apr 21, 2022
8f227d1
Fix debug build compilaton
ptheywood Apr 28, 2022
c728a2d
Add missing <string> include to fix msvc
ptheywood Apr 29, 2022
ba6beba
Attempt to fix Ubuntu CUDA installation
ptheywood Apr 29, 2022
4e4253f
Remove centos cuda install script which is not used in this repo
ptheywood Apr 29, 2022
0095dac
Minor fixes
ptheywood Apr 29, 2022
64d2a3c
Assorted bugfixes
ptheywood May 4, 2022
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
56 changes: 56 additions & 0 deletions .github/problem-matchers.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{
"problemMatcher": [
{
"owner": "cpplint",
"severity": "error",
"pattern": [
{
"regexp": "^(.+):(\\d+):\\s+(.+)\\[(.+)\\]\\s+\\[(.+)\\]$",
"file": 1,
"line": 2,
"message": 3,
"code": 4
}
]
},
{
"owner": "gcc",
"pattern": [
{
"regexp": "^(.*):(\\d+):(\\d+):\\s+(?:fatal\\s+)?(warning|error):\\s+(.*)$",
"file": 1,
"line": 2,
"column": 3,
"severity": 4,
"message": 5
}
]
},
{
"owner": "msbuild",
"pattern": [
{
"regexp": "^(?:\\s+\\d+\\>)?([^\\s].*)\\((\\d+),?(\\d+)?(?:,\\d+,\\d+)?\\)\\s*:\\s+(error|warning|info)\\s+(\\w{1,2}\\d+)\\s*:\\s*(.*)$",
"file": 1,
"line": 2,
"column": 3,
"severity": 4,
"code": 5,
"message": 6
}
]
},
{
"owner": "nvcc",
"pattern": [
{
"regexp": "^(?:\\s+\\d+\\>)?([^\\s].*)\\((\\d+)\\):\\s+(warning|error)\\s* (?:#\\S+)?\\s*:\\s+(.*)$",
"file": 1,
"line": 2,
"severity": 3,
"message": 4
}
]
}
]
}
196 changes: 196 additions & 0 deletions .github/scripts/install_cuda_ubuntu.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,196 @@
# @todo - better / more robust parsing of inputs from env vars.
## -------------------
## Constants
## -------------------

# List of sub-packages to install.
# @todo - pass this in from outside the script?
# @todo - check the specified subpackages exist via apt pre-install? apt-rdepends cuda-9-0 | grep "^cuda-"?

# Ideally choose from the list of meta-packages to minimise variance between cuda versions (although it does change too). Some of these packages may not be availble pre cuda 10.
CUDA_PACKAGES_IN=(
"cuda-compiler"
"cuda-cudart-dev"
"cuda-nvtx"
"cuda-nvrtc-dev"
"libcurand-dev" # 11-0+
"cuda-cccl" # 11.4+, provides cub and thrust. On 11.3 knwon as cuda-thrust-11-3
)

## -------------------
## Bash functions
## -------------------
# returns 0 (true) if a >= b
function version_ge() {
[ "$#" != "2" ] && echo "${FUNCNAME[0]} requires exactly 2 arguments." && exit 1
[ "$(printf '%s\n' "$@" | sort -V | head -n 1)" == "$2" ]
}
# returns 0 (true) if a > b
function version_gt() {
[ "$#" != "2" ] && echo "${FUNCNAME[0]} requires exactly 2 arguments." && exit 1
[ "$1" = "$2" ] && return 1 || version_ge $1 $2
}
# returns 0 (true) if a <= b
function version_le() {
[ "$#" != "2" ] && echo "${FUNCNAME[0]} requires exactly 2 arguments." && exit 1
[ "$(printf '%s\n' "$@" | sort -V | head -n 1)" == "$1" ]
}
# returns 0 (true) if a < b
function version_lt() {
[ "$#" != "2" ] && echo "${FUNCNAME[0]} requires exactly 2 arguments." && exit 1
[ "$1" = "$2" ] && return 1 || version_le $1 $2
}

## -------------------
## Select CUDA version
## -------------------

# Get the cuda version from the environment as $cuda.
CUDA_VERSION_MAJOR_MINOR=${cuda}

# Split the version.
# We (might/probably) don't know PATCH at this point - it depends which version gets installed.
CUDA_MAJOR=$(echo "${CUDA_VERSION_MAJOR_MINOR}" | cut -d. -f1)
CUDA_MINOR=$(echo "${CUDA_VERSION_MAJOR_MINOR}" | cut -d. -f2)
CUDA_PATCH=$(echo "${CUDA_VERSION_MAJOR_MINOR}" | cut -d. -f3)
# use lsb_release to find the OS.
UBUNTU_VERSION=$(lsb_release -sr)
UBUNTU_VERSION="${UBUNTU_VERSION//.}"

echo "CUDA_MAJOR: ${CUDA_MAJOR}"
echo "CUDA_MINOR: ${CUDA_MINOR}"
echo "CUDA_PATCH: ${CUDA_PATCH}"
# echo "UBUNTU_NAME: ${UBUNTU_NAME}"
echo "UBUNTU_VERSION: ${UBUNTU_VERSION}"

# If we don't know the CUDA_MAJOR or MINOR, error.
if [ -z "${CUDA_MAJOR}" ] ; then
echo "Error: Unknown CUDA Major version. Aborting."
exit 1
fi
if [ -z "${CUDA_MINOR}" ] ; then
echo "Error: Unknown CUDA Minor version. Aborting."
exit 1
fi
# If we don't know the Ubuntu version, error.
if [ -z ${UBUNTU_VERSION} ]; then
echo "Error: Unknown Ubuntu version. Aborting."
exit 1
fi


## -------------------------------
## Select CUDA packages to install
## -------------------------------
CUDA_PACKAGES=""
for package in "${CUDA_PACKAGES_IN[@]}"
do :
# @todo This is not perfect. Should probably provide a separate list for diff versions
# cuda-compiler-X-Y if CUDA >= 9.1 else cuda-nvcc-X-Y
if [[ "${package}" == "cuda-nvcc" ]] && version_ge "$CUDA_VERSION_MAJOR_MINOR" "9.1" ; then
package="cuda-compiler"
elif [[ "${package}" == "cuda-compiler" ]] && version_lt "$CUDA_VERSION_MAJOR_MINOR" "9.1" ; then
package="cuda-nvcc"
# CUB/Thrust are packages in cuda-thrust in 11.3, but cuda-cccl in 11.4+
elif [[ "${package}" == "cuda-thrust" || "${package}" == "cuda-cccl" ]]; then
# CUDA cuda-thrust >= 11.4
if version_ge "$CUDA_VERSION_MAJOR_MINOR" "11.4" ; then
package="cuda-cccl"
# Use cuda-thrust > 11.2
elif version_ge "$CUDA_VERSION_MAJOR_MINOR" "11.3" ; then
package="cuda-thrust"
# Do not include this pacakge < 11.3
else
continue
fi
fi
# CUDA 11+ includes lib* / lib*-dev packages, which if they existed previously where cuda-cu*- / cuda-cu*-dev-
if [[ ${package} == libcu* ]] && version_lt "$CUDA_VERSION_MAJOR_MINOR" "11.0" ; then
package="${package/libcu/cuda-cu}"
fi
# Build the full package name and append to the string.
CUDA_PACKAGES+=" ${package}-${CUDA_MAJOR}-${CUDA_MINOR}"
done
echo "CUDA_PACKAGES ${CUDA_PACKAGES}"

## -----------------
## Prepare to install
## -----------------
CPU_ARCH="x86_64"
PIN_FILENAME="cuda-ubuntu${UBUNTU_VERSION}.pin"
PIN_URL="https://developer.download.nvidia.com/compute/cuda/repos/ubuntu${UBUNTU_VERSION}/${CPU_ARCH}/${PIN_FILENAME}"
# apt keyring package now available https://developer.nvidia.com/blog/updating-the-cuda-linux-gpg-repository-key/
KERYRING_PACKAGE_FILENAME="cuda-keyring_1.0-1_all.deb"
KEYRING_PACKAGE_URL="https://developer.download.nvidia.com/compute/cuda/repos/ubuntu${UBUNTU_VERSION}/${CPU_ARCH}/${KERYRING_PACKAGE_FILENAME}"
REPO_URL="https://developer.download.nvidia.com/compute/cuda/repos/ubuntu${UBUNTU_VERSION}/${CPU_ARCH}/"

echo "PIN_FILENAME ${PIN_FILENAME}"
echo "PIN_URL ${PIN_URL}"
echo "KEYRING_PACKAGE_URL ${KEYRING_PACKAGE_URL}"
echo "APT_KEY_URL ${APT_KEY_URL}"

## -----------------
## Check for root/sudo
## -----------------

# Detect if the script is being run as root, storing true/false in is_root.
is_root=false
if (( $EUID == 0)); then
is_root=true
fi
# Find if sudo is available
has_sudo=false
if command -v sudo &> /dev/null ; then
has_sudo=true
fi
# Decide if we can proceed or not (root or sudo is required) and if so store whether sudo should be used or not.
if [ "$is_root" = false ] && [ "$has_sudo" = false ]; then
echo "Root or sudo is required. Aborting."
exit 1
elif [ "$is_root" = false ] ; then
USE_SUDO=sudo
else
USE_SUDO=
fi

## -----------------
## Install
## -----------------
echo "Adding CUDA Repository"
wget ${PIN_URL}
$USE_SUDO mv ${PIN_FILENAME} /etc/apt/preferences.d/cuda-repository-pin-600
wget ${KEYRING_PACKAGE_URL} && ${USE_SUDO} dpkg -i ${KERYRING_PACKAGE_FILENAME} && rm ${KERYRING_PACKAGE_FILENAME}
$USE_SUDO add-apt-repository "deb ${REPO_URL} /"
$USE_SUDO apt-get update

echo "Installing CUDA packages ${CUDA_PACKAGES}"
$USE_SUDO apt-get -y install ${CUDA_PACKAGES}

if [[ $? -ne 0 ]]; then
echo "CUDA Installation Error."
exit 1
fi

## -----------------
## Set environment vars / vars to be propagated
## -----------------

CUDA_PATH=/usr/local/cuda-${CUDA_MAJOR}.${CUDA_MINOR}
echo "CUDA_PATH=${CUDA_PATH}"
export CUDA_PATH=${CUDA_PATH}
export PATH="$CUDA_PATH/bin:$PATH"
export LD_LIBRARY_PATH="$CUDA_PATH/lib:$LD_LIBRARY_PATH"
export LD_LIBRARY_PATH="$CUDA_PATH/lib64:$LD_LIBRARY_PATH"
# Check nvcc is now available.
nvcc -V


# If executed on github actions, make the appropriate echo statements to update the environment
if [[ $GITHUB_ACTIONS ]]; then
# Set paths for subsequent steps, using ${CUDA_PATH}
echo "Adding CUDA to CUDA_PATH, PATH and LD_LIBRARY_PATH"
echo "CUDA_PATH=${CUDA_PATH}" >> $GITHUB_ENV
echo "${CUDA_PATH}/bin" >> $GITHUB_PATH
echo "LD_LIBRARY_PATH=${CUDA_PATH}/lib:${LD_LIBRARY_PATH}" >> $GITHUB_ENV
echo "LD_LIBRARY_PATH=${CUDA_PATH}/lib64:${LD_LIBRARY_PATH}" >> $GITHUB_ENV
fi
Loading