Skip to content
Merged
Show file tree
Hide file tree
Changes from 9 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
100 changes: 61 additions & 39 deletions U/UCX/build_tarballs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,21 @@ using BinaryBuilder, Pkg

const YGGDRASIL_DIR = "../.."
include(joinpath(YGGDRASIL_DIR, "platforms", "cuda.jl"))
include(joinpath(YGGDRASIL_DIR, "fancy_toys.jl"))

name = "UCX"
version = v"1.18.0"
version = v"1.20.0"

# Collection of sources required to complete build
sources = [
GitSource("https://github.com/openucx/ucx.git",
"693d02837894b9c346c9f91b105e4aff6f259c09"),
"4b7a6ca8410f9cea0e15857233ecfeefdd863dde"),
]

# Bash recipe for building across all platforms
script = raw"""
cd $WORKSPACE/srcdir/ucx*

# Apply all our patches
if [ -d $WORKSPACE/srcdir/patches ]; then
for f in $WORKSPACE/srcdir/patches/*.patch; do
echo "Applying patch ${f}"
atomic_patch -p1 ${f}
done
fi
./autogen.sh
update_configure_scripts --reconf

Expand All @@ -43,32 +37,23 @@ FLAGS+=(--enable-frame-pointer)
FLAGS+=(--enable-cma)
FLAGS+=(--with-rdmacm=${prefix})

if [[ "${target}" != *aarch64* ]]; then
FLAGS+=(--with-cuda=${prefix}/cuda)
fi

if [[ "${target}" == *x86_64* ]]; then
FLAGS+=(--with-rocm=${prefix})
fi
"""

./configure ${FLAGS[@]}
MIN_CUDA_VERSION = v"12.2"
MAX_CUDA_VERSION = v"13.0.999"

# For a bug in `src/uct/sm/cma/Makefile` that I did't have the time to look
# into, we have to build with `V=1`
make -j${nproc} V=1
make install
cpu_platforms = [Platform("x86_64", "linux"; libc="glibc"), Platform("aarch64", "linux"; libc="glibc")]

install_license LICENSE
"""
cuda_platforms = CUDA.supported_platforms(; min_version = MIN_CUDA_VERSION, max_version = MAX_CUDA_VERSION)
filter!(p -> arch(p) == "x86_64", cuda_platforms) # ARM+CUDA+UCX should work, but not gonna do that today

# These are the platforms we will build for by default, unless further
# platforms are passed in on the command line
platforms = [
Platform("x86_64", "linux"; libc="glibc"),
Platform("aarch64", "linux"; libc="glibc"),
Platform("powerpc64le", "linux"; libc="glibc"),
]
all_platforms = [cpu_platforms; cuda_platforms]

for platform in all_platforms
if CUDA.is_supported(platform) && !haskey(platform, "cuda")
platform["cuda"] = "none"
end
end

# The products that we will ensure are always built
products = [
Expand All @@ -90,17 +75,54 @@ products = [
# - gdrcopy -> kernel module
# - ROCM -> TODO

cuda_version = v"11.4"
rocm_version = v"4.2.0"

dependencies = [
Dependency("NUMA_jll"),
Dependency("rdma_core_jll"),
Dependency(PackageSpec(name="CompilerSupportLibraries_jll", uuid="e66e0078-7015-5450-92f7-15fbd957f2ae")),
Dependency(PackageSpec(name="NUMA_jll", uuid="7f51dc2b-bb24-59f8-b771-bb1490e4195d")),
Dependency(PackageSpec(name="rdma_core_jll", uuid="69dc3629-5c98-505f-8bcd-225213cebe70")),
BuildDependency(PackageSpec(name="CUDA_full_jll", version=CUDA.full_version(cuda_version))),
BuildDependency(PackageSpec(name="hsa_rocr_jll", version=rocm_version))
]

# Build the tarballs, and possibly a `build.jl` as well.
build_tarballs(ARGS, name, version, sources, script, platforms, products, dependencies;
preferred_gcc_version=v"5")

for platform in all_platforms

should_build_platform(triplet(platform)) || continue

platform_deps = BinaryBuilder.AbstractDependency[dependencies...]
platform_script = deepcopy(script)

if haskey(platform, "cuda") && platform["cuda"] != "none"
append!(platform_deps, CUDA.required_dependencies(platform))

platform_script *= "\n"
platform_script *= raw"""
FLAGS+=(--with-cuda=${prefix}/cuda)
export CUDA_HOME=${prefix}/cuda;
export PATH=$PATH:$CUDA_HOME/bin
export CUDACXX=$CUDA_HOME/bin/nvcc
export CUDA_LIB=${CUDA_HOME}/lib
"""

end

platform_script *= "\n"
platform_script *= raw"""
./configure ${FLAGS[@]}

# For a bug in `src/uct/sm/cma/Makefile` that I did't have the time to look
# into, we have to build with `V=1`
make -j${nproc} V=1
make install

install_license LICENSE
"""

build_tarballs(
ARGS, name, version, sources,
platform_script, [platform], products, platform_deps;
julia_compat = "1.10",
preferred_gcc_version = v"7",
lazy_artifacts = true,
augment_platform_block = CUDA.augment
)

end
Comment thread
ejmeitz marked this conversation as resolved.
Outdated
Empty file removed U/UCX/bundled/.empty
Empty file.