Skip to content
Merged
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
2 changes: 1 addition & 1 deletion .githash
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5f235a255f7b040ede53f151d0652d6352e087e9
b1468726ba4827ab3e5ebb6e96ad94b9df78aa46
44 changes: 11 additions & 33 deletions .github/workflows/developer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,50 +41,29 @@ jobs:
# runs-on: [self-hosted, linux, x64]
runs-on: ubuntu-latest
container:
# need nvcc
image: nvidia/cuda:12.4.0-devel-ubuntu22.04
# options: --gpus all
image: ubuntu:22.04
defaults:
run:
shell: bash
env:
LEGATE_AUTO_CONFIG: 0
NO_CUDA: ON
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: bash
run: source /etc/profile
- name: Get package spec
id: pkg
run: |
if [[ -n "${{ inputs.tag }}" ]]; then
echo "ref=${{ inputs.tag }}" >> $GITHUB_OUTPUT
echo "name=${{ inputs.tag }}" >> $GITHUB_OUTPUT
elif [[ "${{ github.ref_type }}" == "tag" ]]; then
echo "ref=${{ github.ref_name }}" >> $GITHUB_OUTPUT
echo "name=${{ github.ref_name }}" >> $GITHUB_OUTPUT
elif [[ "${{ github.event_name }}" == "pull_request" ]]; then
echo "ref=${{ github.sha }}" >> $GITHUB_OUTPUT
echo "name=pr-${{ github.event.pull_request.number }}" >> $GITHUB_OUTPUT
elif [[ "${{ github.ref_type }}" == "branch" ]]; then
echo "ref=${{ github.ref_name }}" >> $GITHUB_OUTPUT
echo "name=${{ github.ref_name }}" >> $GITHUB_OUTPUT
else
echo "ref=${{ github.sha }}" >> $GITHUB_OUTPUT
echo "name=dev" >> $GITHUB_OUTPUT
fi

VERSION=$(grep "^version = " Project.toml | cut -d'"' -f2)
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Install basic utils
run: |
apt-get update && apt-get install -y wget curl git build-essential
curl -fsSL https://deb.nodesource.com/setup_20.x | bash -
apt-get install -y nodejs

- name: Setup Julia
uses: julia-actions/setup-julia@v2
with:
version: '1.11'

- name: Install basic utils
run: apt-get update && apt-get install -y wget curl git build-essential


- name: Install CMake 3.30.7
run: |
Expand All @@ -98,7 +77,7 @@ jobs:
id: julia-cache
uses: julia-actions/cache@v2
with:
cache-name: julia-developer-ci-test-new
cache-name: julia-developer-ci
- name: Cleanup old cuNumeric and Legate
run: |
julia --color=yes -e 'using Pkg; Pkg.rm("cuNumeric")' || true # ensure clean env
Expand All @@ -113,16 +92,15 @@ jobs:
using LegatePreferences; LegatePreferences.use_developer_mode();
Pkg.add(PackageSpec(url = "https://github.com/JuliaLegate/Legate.jl", rev = "main"))
'
julia --color=yes -e 'using Pkg; Pkg.build("Legate")'

julia --color=yes -e '
using Pkg;
Pkg.add(PackageSpec(url = "https://github.com/JuliaLegate/cuNumeric.jl", rev = "${{ steps.pkg.outputs.ref }}", subdir = "lib/CNPreferences"))
Pkg.develop(PackageSpec(path = "lib/CNPreferences"))
using CNPreferences; CNPreferences.use_developer_mode();
Pkg.add(PackageSpec(url = "https://github.com/JuliaLegate/cuNumeric.jl", rev = "${{ steps.pkg.outputs.ref }}"))
Pkg.develop(PackageSpec(path = "."))
'
julia --color=yes -e 'using Pkg; Pkg.build("cuNumeric")'

- name: Perform Test
run: |
julia --color=yes -e 'using Pkg; Pkg.test("cuNumeric")'
GPUTESTS=0 julia --color=yes -e 'using Pkg; Pkg.test("cuNumeric")'
17 changes: 0 additions & 17 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,22 +66,6 @@ jobs:
julia --color=yes -e 'using Pkg; Pkg.rm("cuNumeric")' || true # ensure clean env
julia --color=yes -e 'using Pkg; Pkg.rm("Legate")' || true # ensure clean env

- name: Setup CUDA runtime version
run: |
julia --color=yes --project=docs -e '
using Pkg
Pkg.add("CUDA")
using CUDA
CUDA.set_runtime_version!(v"12.4")
'
- name: Set LD_LIBRARY_PATH for CUDA_Driver_jll
run: |
echo "LD_LIBRARY_PATH=$(julia -e 'using Pkg; \
Pkg.add(name = "CUDA_Driver_jll", version = "0.12.1"); \
using CUDA_Driver_jll; \
print(joinpath(CUDA_Driver_jll.artifact_dir, "lib"))' \
):$LD_LIBRARY_PATH" >> $GITHUB_ENV

- name: Clone cuNumeric at ref
run: |
REF=${{ steps.pkg.outputs.ref }}
Expand All @@ -104,7 +88,6 @@ jobs:
run: |
julia --color=yes --project=docs -e '
using Pkg
Pkg.add(PackageSpec(url = "https://github.com/JuliaLegate/Legate.jl", rev = "main", subdir = "lib/LegatePreferences"))
Pkg.add(PackageSpec(url = "https://github.com/JuliaLegate/Legate.jl", rev = "main"))
Pkg.develop(path = joinpath(homedir(), ".julia", "dev", "cuNumeric/lib/CNPreferences"))
Pkg.develop(path = joinpath(homedir(), ".julia", "dev", "cuNumeric"))
Expand Down
17 changes: 9 additions & 8 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@ version = "0.1.0"

[deps]
CNPreferences = "3e078157-ea10-49d5-bf32-908f777cd46f"
CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba"
CUDA_Driver_jll = "4ee394cb-3365-5eb0-8335-949819d2adfc"
CUDA_Runtime_jll = "76a88914-d11a-5bdc-97e0-2f5a05c973a2"
CUTENSOR_jll = "35b6c64b-1ee1-5834-92a3-3f624899209a"
CodecZlib = "944b1d66-785c-5afd-91f1-9de20f533193"
CxxWrap = "1f15a43c-97ca-5a2a-ae31-89f07a497df4"
Downloads = "f43a241f-c20a-4ad4-852c-f6b1247861c6"
Expand All @@ -18,7 +14,6 @@ Libdl = "8f399da3-3557-5675-b5ff-fb832c97cbdb"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
MacroTools = "1914dd2f-81c6-5fcd-8719-6d5c9610ff09"
OpenBLAS32_jll = "656ef2d0-ae68-5445-9ca0-591084a874a2"
OpenSSL_jll = "458c3c95-2e84-50aa-8efc-19380b2a3a95"
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
Preferences = "21216c6a-2e73-6563-6e65-726566657250"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
Expand All @@ -29,14 +24,20 @@ cunumeric_jl_wrapper_jll = "49048992-29d2-5fd1-994f-9cecf112d624"
cupynumeric_jll = "2862d674-414d-5b0b-a494-b21f8deca547"
libcxxwrap_julia_jll = "3eaa8342-bff7-56a5-9981-c04077f7cee7"

[weakdeps]
CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba"

[compat]
CUDA = "5.9"
CNPreferences = "0.1.2"
CxxWrap = "0.17"
Legate = "0.1.0"
LegatePreferences = "0.1.5"
MacroTools = "0.5.16"
OpenBLAS32_jll = "0.3"
StatsBase = "0.34"
cunumeric_jl_wrapper_jll = "25.10.0"
cupynumeric_jll = "25.10.0"
cunumeric_jl_wrapper_jll = "25.10.1"
cupynumeric_jll = "25.10.1"
julia = "1.10"

[ext]
CUDAExt = "CUDA"
6 changes: 3 additions & 3 deletions deps/build.jl
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ function build_jlcxxwrap(repo_root)
end

function build_cpp_wrapper(
repo_root, cupynumeric_loc, legate_loc, blas_lib, install_root
repo_root, cupynumeric_loc, legate_loc, blas_loc, install_root
)
@info "libcunumeric_jl_wrapper: Building C++ Wrapper Library"
if isdir(install_root)
Expand All @@ -126,7 +126,7 @@ function build_cpp_wrapper(
build_cpp_wrapper = joinpath(repo_root, "scripts/build_cpp_wrapper.sh")
nthreads = Threads.nthreads()

bld_command = `$build_cpp_wrapper $repo_root $cupynumeric_loc $legate_loc $blas_lib $install_root $nthreads`
bld_command = `$build_cpp_wrapper $repo_root $cupynumeric_loc $legate_loc $blas_loc $install_root $nthreads`

# write out a bash script for debugging
cmd_str = join(bld_command.exec, " ")
Expand Down Expand Up @@ -197,7 +197,7 @@ function build(mode)
)
end
build_cpp_wrapper(
pkg_root, cupynumeric_root, up_dir(legate_lib), blas_lib,
pkg_root, cupynumeric_root, up_dir(legate_lib), up_dir(blas_lib),
install_lib,
)
end
Expand Down
20 changes: 20 additions & 0 deletions ext/CUDAExt/CUDAExt.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
module CUDAExt

using Random
using CUDA
using cuNumeric

include("cuda.jl")

function __init__()
if CUDA.functional()
# in cuda.jl to notify /wrapper/src/cuda.cpp about CUDA.jl kernel state size
cuNumeric.set_kernel_state_size();
# in /wrapper/src/cuda.cpp
cuNumeric.register_tasks();
else
@warn "CUDA.jl is not functional; skipping CUDA kernel registration."
end
end

end # module CUDAExt
5 changes: 2 additions & 3 deletions src/cuda.jl → ext/CUDAExt/cuda.jl
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
using CUDA
using Random
export @cuda_task, @launch

const KERNEL_OFFSET = sizeof(CUDA.KernelState)

# cuNumeric.jl init will call this
# __init__ will call this
# kernel_state is the first ARG in the generated PTX in CUDA.jl
function set_kernel_state_size()
cuNumeric.register_kernel_state_size(UInt64(KERNEL_OFFSET))
Expand Down
8 changes: 6 additions & 2 deletions scripts/build_cpp_wrapper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ set -e

# Check if exactly one argument is provided
if [[ $# -ne 6 ]]; then
echo "Usage: $0 <cunumeric-pkg> <cupynumeric-root> <legate-root> <blas-lib> <install-dir> <nthreads>"
echo "Usage: $0 <cunumeric-pkg> <cupynumeric-root> <legate-root> <blas-root> <install-dir> <nthreads>"
exit 1
fi
CUNUMERICJL_ROOT_DIR=$1 # this is the repo root of cunumeric.jl
CUPYNUMERIC_ROOT_DIR=$2
LEGATE_ROOT_DIR=$3
BLAS_LIB_DIR=$4
BLAS_ROOT_DIR=$4
INSTALL_DIR=$5
NTHREADS=$6

Expand Down Expand Up @@ -42,10 +42,14 @@ fi

echo $LEGATE_ROOT_DIR

# Default to OFF (CUDA support enabled), but allow override via environment variable
NO_CUDA=${NO_CUDA:-OFF}

if [[ ! -f "$BUILD_DIR/CMakeCache.txt" ]]; then
echo "Configuring project..."
cmake -S "$CUNUMERIC_WRAPPER_SOURCE" -B "$BUILD_DIR" \
-D BINARYBUILDER=OFF \
-D NOCUDA=$NO_CUDA \
-D CMAKE_INSTALL_PREFIX="$INSTALL_DIR" \
-D CMAKE_PREFIX_PATH="$CUPYNUMERIC_ROOT_DIR;$LEGATE_ROOT_DIR;" \
-D CUPYNUMERIC_PATH="$CUPYNUMERIC_ROOT_DIR" \
Expand Down
Loading