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

Improve the CUDA C++ implementation #1

Closed
wants to merge 2 commits into from
Closed
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
113 changes: 113 additions & 0 deletions scripts/nvidia_hpc_sdk
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
#!/usr/bin/env sh
# Copyright (c) 2024, NVIDIA CORPORATION. All rights reservd.
#
# For full license terms please see the LICENSE file distributed with this
# source code
#
# Compiles & runs models supported by NVIDIA HPC SDK for NVIDIA GPUs.
#
# Usage ./scripts/nvidia_hpc_sdk <model> <arraysize>
set -ex
# Pick the HPC SDK version used with this variable
IMG=nvcr.io/nvidia/nvhpc:24.1-devel-cuda12.3-ubuntu22.04

MODEL=cuda
if [ ! -z $1 ]; then
MODEL=$1
fi
#SIZE=268435456 #This is a power of 2
SIZE=268435457
if [ ! -z $2 ]; then
SIZE=$2
fi

rm -rf build || true
mkdir -p build

docker run \
-it \
--gpus=all \
--privileged \
-u $(id -u):$(id -g) \
-v $(pwd):/src \
-w /src \
$IMG \
bash -c "set -ex && \
cmake -Bbuild -H. \
-DMODEL=${1} \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_CUDA_COMPILER=nvcc \
-DCUDA_ARCH=native \
-DMEM=DEFAULT \
-DAUTOTUNE=ON \
-DVECTORIZATION=ON \
-DCMAKE_CXX_COMPILER=g++ \
&& \
cmake --build build -v && \
./build/${1}-stream --arraysize ${SIZE}"

docker run \
-it \
--gpus=all \
--privileged \
-u $(id -u):$(id -g) \
-v $(pwd):/src \
-w /src \
$IMG \
bash -c "set -ex && \
cmake -Bbuild -H. \
-DMODEL=${1} \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_CUDA_COMPILER=nvcc \
-DCUDA_ARCH=native \
-DMEM=DEFAULT \
-DAUTOTUNE=ON \
-DVECTORIZATION=OFF \
-DCMAKE_CXX_COMPILER=g++ \
&& \
cmake --build build -v && \
./build/${1}-stream --arraysize ${SIZE}"

docker run \
-it \
--gpus=all \
--privileged \
-u $(id -u):$(id -g) \
-v $(pwd):/src \
-w /src \
$IMG \
bash -c "set -ex && \
cmake -Bbuild -H. \
-DMODEL=${1} \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_CUDA_COMPILER=nvcc \
-DCUDA_ARCH=native \
-DMEM=DEFAULT \
-DAUTOTUNE=OFF \
-DVECTORIZATION=ON \
-DCMAKE_CXX_COMPILER=g++ \
&& \
cmake --build build -v && \
./build/${1}-stream --arraysize ${SIZE}"

docker run \
-it \
--gpus=all \
--privileged \
-u $(id -u):$(id -g) \
-v $(pwd):/src \
-w /src \
$IMG \
bash -c "set -ex && \
cmake -Bbuild -H. \
-DMODEL=${1} \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_CUDA_COMPILER=nvcc \
-DCUDA_ARCH=native \
-DMEM=DEFAULT \
-DAUTOTUNE=OFF \
-DVECTORIZATION=OFF \
-DCMAKE_CXX_COMPILER=g++ \
&& \
cmake --build build -v && \
./build/${1}-stream --arraysize ${SIZE}"
Loading
Loading