@@ -7,35 +7,73 @@ include(joinpath(YGGDRASIL_DIR, "fancy_toys.jl"))
7
7
include (joinpath (YGGDRASIL_DIR, " platforms" , " cuda.jl" ))
8
8
9
9
name = " MAGMA"
10
- version = v " 2.7.0"
10
+ version = v " 2.9.0"
11
+
12
+ # Note: Hopper should still build with CUDA v11.8
13
+ # on x86_64, but aarch64 requires CUDA v12.0
14
+ MIN_CUDA_VERSION = v " 12"
11
15
12
16
# Collection of sources required to complete build
13
17
sources = [
14
18
ArchiveSource (" http://icl.utk.edu/projectsfiles/magma/downloads/magma-$(version) .tar.gz" ,
15
- " fda1cbc4607e77cacd8feb1c0f633c5826ba200a018f647f1c5436975b39fd18 " ),
19
+ " ff77fd3726b3dfec3bfb55790b06480aa5cc384396c2db35c56fdae4a82c641c " ),
16
20
DirectorySource (" ./bundled" )
17
21
]
18
22
19
23
# Bash recipe for building across all platforms
20
24
script = raw """
21
- cd $WORKSPACE/srcdir/magma*
25
+ cd $WORKSPACE/srcdir
26
+
27
+ export TMPDIR=${WORKSPACE}/tmpdir # we need a lot of tmp space
28
+ mkdir -p ${TMPDIR}
29
+
30
+ PTROPT=""
31
+
32
+ # Necessary operations to cross compile CUDA from x86_64 to aarch64
33
+ if [[ "${target}" == aarch64-linux-* ]]; then
34
+
35
+ # Add /usr/lib/csl-musl-x86_64 to LD_LIBRARY_PATH to be able to use host nvcc
36
+ export LD_LIBRARY_PATH="/usr/lib/csl-musl-x86_64:/usr/lib/csl-glibc-x86_64:${LD_LIBRARY_PATH}"
37
+
38
+ # Make sure we use host CUDA executable by copying from the x86_64 CUDA redist
39
+ NVCC_DIR=(/workspace/srcdir/cuda_nvcc-*-archive)
40
+ rm -rf ${prefix}/cuda/bin
41
+ cp -r ${NVCC_DIR}/bin ${prefix}/cuda/bin
42
+
43
+ rm -rf ${prefix}/cuda/nvvm/bin
44
+ cp -r ${NVCC_DIR}/nvvm/bin ${prefix}/cuda/nvvm/bin
45
+
46
+ # Workaround failed execution of sizeptr in cross-compile builds
47
+ PTROPT="PTRSIZE=8"
48
+ fi
49
+
50
+ export CUDADIR=${prefix}/cuda
51
+ export PATH=${PATH}:${CUDADIR}/bin
52
+ export CUDACXX=${CUDADIR}/bin/nvcc
53
+
54
+ # This flag reduces the size of the compiled binaries; if
55
+ # they become over 2GB (e.g. due to targeting too many
56
+ # compute_XX), linking fails.
57
+ # See: https://github.com/NixOS/nixpkgs/pull/220402
58
+ export NVCC_PREPEND_FLAGS+=' -Xfatbin=-compress-all'
22
59
23
- export CUDADIR=${WORKSPACE}/destdir/cuda
24
- export PATH=${PATH}:${CUDADIR}
60
+ cd magma*
25
61
cp ../make.inc .
62
+
26
63
# Patch to _64_ suffixes
27
64
atomic_patch -p1 ../0001-mangle-to-ILP64.patch
28
- # reduce parallelism since otherwise the builder may OOM.
29
- (( nproc=1+nproc/3 ))
30
- make -j${nproc} sparse-shared
31
- make install prefix=${prefix}
65
+
66
+ make ${PTROPT} -j${ nproc} sparse-shared
67
+ make ${PTROPT} install prefix=${prefix}
68
+
32
69
install_license COPYRIGHT
33
- """
34
70
35
- augment_platform_block = CUDA. augment
71
+ # ensure products directory is clean
72
+ rm -rf ${CUDADIR}
73
+ """
36
74
37
- platforms = CUDA. supported_platforms ()
38
- filter! (p -> arch (p) == " x86_64" , platforms)
75
+ platforms = CUDA. supported_platforms (min_version = MIN_CUDA_VERSION )
76
+ filter! (p -> arch (p) == " x86_64" || arch (p) == " aarch64 " , platforms)
39
77
platforms = expand_cxxstring_abis (platforms)
40
78
41
79
@@ -56,10 +94,18 @@ for platform in platforms
56
94
57
95
cuda_deps = CUDA. required_dependencies (platform)
58
96
59
- build_tarballs (ARGS , name, version, sources, script, [platform],
97
+ cuda_ver = platform[" cuda" ]
98
+
99
+ platform_sources = BinaryBuilder. AbstractSource[sources... ]
100
+
101
+ if arch (platform) == " aarch64"
102
+ push! (platform_sources, CUDA. cuda_nvcc_redist_source (cuda_ver, " x86_64" ))
103
+ end
104
+
105
+ build_tarballs (ARGS , name, version, platform_sources, script, [platform],
60
106
products, [dependencies; cuda_deps];
61
107
preferred_gcc_version= v " 8" ,
62
108
julia_compat= " 1.8" ,
63
- augment_platform_block,
109
+ augment_platform_block= CUDA . augment ,
64
110
skip_audit= true , dont_dlopen= true )
65
111
end
0 commit comments