diff --git a/S/SuperLU_MT/build_tarballs.jl b/S/SuperLU_MT/build_tarballs.jl new file mode 100644 index 00000000000..4d6dc461fc9 --- /dev/null +++ b/S/SuperLU_MT/build_tarballs.jl @@ -0,0 +1,76 @@ +# Note that this script can accept some limited command-line arguments, run +# `julia build_tarballs.jl --help` to see a usage message. +using BinaryBuilder + +name = "SuperLU_MT" +version = v"3.1" + +# Collection of sources required to build Elemental +sources = [ + ArchiveSource("https://portal.nersc.gov/project/sparse/superlu/superlu_mt_3.1.tar.gz", + "407b544b9a92b2ed536b1e713e80f986824cf3016657a4bfc2f3e7d2a76ecab6"), + DirectorySource("bundled"), +] + +# Bash recipe for building across all platforms +script = raw""" +cd SuperLU_MT_* + +cp MAKE_INC/make.linux.openmp make.inc + +atomic_patch -p1 ../patches/01-fix-makefile.patch + +# Build object files suitable for a shared library, and link the libraries we need. +echo "CFLAGS += -fPIC -fopenmp \$(BLASLIB)" >> make.inc +echo "NOOPTS += -fPIC -fopenmp \$(BLASLIB)" >> make.inc + +# We need to add a suffix to BLAS symbols. +SYMBOLS=() +for fun in isamax sasum saxpy scopy strsv idamax dasum daxpy dcopy dtrsv ctrsv ztrsv; do + SYMBOLS+=("-D$fun=${fun}_") +done +echo "CFLAGS += ${SYMBOLS[@]}" >> make.inc + +# Don't use 64-bit integers on non-64-bit systems. +if [[ "$nbits" != 64 ]]; then + sed -i "s/^CFLAGS.*+= -D_LONGINT$//" make.inc +fi + +# Clang doesn't play nicely with OpenMP. +if [[ "$target" == *-freebsd* || "$target" == *-apple-* ]]; then + CC=gcc +fi + +# Weird sed delimiters because some variables contain slashes. +sed -i "s~^BLASLIB.*~BLASLIB = -L$libdir -lopenblas~" make.inc +sed -i "s~^CC.*~CC = $CC~" make.inc +sed -i "s~^FORTRAN.*~FORTRAN = $FC~" make.inc + +make superlulib "-j$nproc" +cp lib/single "$libdir/libsuperlumts.$dlext" +cp lib/double "$libdir/libsuperlumtd.$dlext" +cp lib/complex "$libdir/libsuperlumtc.$dlext" +cp lib/complex16 "$libdir/libsuperlumtz.$dlext" +cp SRC/*.h "$prefix/include" +""" + +# These are the platforms we will build for by default, unless further +# platforms are passed in on the command line +platforms = supported_platforms() + +# The products that we will ensure are always built +products = [ + LibraryProduct("libsuperlumts", :libsuperlumts), + LibraryProduct("libsuperlumtd", :libsuperlumtd), + LibraryProduct("libsuperlumtc", :libsuperlumtc), + LibraryProduct("libsuperlumtz", :libsuperlumtz), +] + +# Dependencies that must be installed before this package can be built +dependencies = [ + Dependency("CompilerSupportLibraries_jll"), + Dependency("OpenBLAS32_jll"), +] + +# Build the tarballs, and possibly a `build.jl` as well. +build_tarballs(ARGS, name, version, sources, script, platforms, products, dependencies) diff --git a/S/SuperLU_MT/bundled/patches/01-fix-makefile.patch b/S/SuperLU_MT/bundled/patches/01-fix-makefile.patch new file mode 100644 index 00000000000..896bbeeb825 --- /dev/null +++ b/S/SuperLU_MT/bundled/patches/01-fix-makefile.patch @@ -0,0 +1,42 @@ +diff --git a/SRC/Makefile b/SRC/Makefile +index 81209e5..83286b3 100644 +--- a/SRC/Makefile ++++ b/SRC/Makefile +@@ -102,20 +102,16 @@ ZLUSRC = dcomplex.o zreadhb.o zreadrb.o zmatgen.o dzsum1.o izmax1.o \ + all: single double complex complex16 + + single: $(SLUSRC) $(ALLAUX) $(SZAUX) +- $(ARCH) $(ARCHFLAGS) ../lib/$(SUPERLULIB) $(SLUSRC) $(ALLAUX) $(SZAUX) +- $(RANLIB) ../lib/$(SUPERLULIB) ++ $(CC) $(CFLAGS) -shared -o ../lib/single $(SLUSRC) $(ALLAUX) $(SZAUX) + + double: $(DLUSRC) $(ALLAUX) $(DZAUX) +- $(ARCH) $(ARCHFLAGS) ../lib/$(SUPERLULIB) $(DLUSRC) $(ALLAUX) $(DZAUX) +- $(RANLIB) ../lib/$(SUPERLULIB) ++ $(CC) $(CFLAGS) -shared -o ../lib/double $(DLUSRC) $(ALLAUX) $(DZAUX) + + complex: $(CLUSRC) $(ALLAUX) $(SZAUX) +- $(ARCH) $(ARCHFLAGS) ../lib/$(SUPERLULIB) $(CLUSRC) $(ALLAUX) $(SZAUX) +- $(RANLIB) ../lib/$(SUPERLULIB) ++ $(CC) $(CFLAGS) -shared -o ../lib/complex $(CLUSRC) $(ALLAUX) $(SZAUX) + + complex16: $(ZLUSRC) $(ALLAUX) $(DZAUX) +- $(ARCH) $(ARCHFLAGS) ../lib/$(SUPERLULIB) $(ZLUSRC) $(ALLAUX) $(DZAUX) +- $(RANLIB) ../lib/$(SUPERLULIB) ++ $(CC) $(CFLAGS) -shared -o ../lib/complex16 $(ZLUSRC) $(ALLAUX) $(DZAUX) + + ################################## + # Do not optimize this routine # +@@ -127,10 +123,10 @@ dclock.o: dclock.c ; $(CC) -c $(PREDEFS) $(NOOPTS) $< + + # Do not optimize this on Cray; related to 'volatile' variable. + await.o: await.c +- $(CC) -c $(NOOPTS) $< $(VERBOSE) ++ $(CC) -c $(NOOPTS) $< + + .c.o: +- $(CC) $(CFLAGS) $(CDEFS) $(BLASDEF) -c $< $(VERBOSE) ++ $(CC) $(CFLAGS) $(CDEFS) $(BLASDEF) -c $< + + clean: + rm -f *.o core ../lib/$(SUPERLULIB)