From 066825ebb3d450ccd1315122d1fd0e473f91798e Mon Sep 17 00:00:00 2001 From: Tony Kelman Date: Sun, 19 Oct 2014 07:27:59 -0700 Subject: [PATCH 1/5] Patch openblas to add 64_ suffix when using 64 bit ints objconv cannot do in-place modification of files dont overwrite static library with objcopy on freebsd either fix linking of arpack and suitesparse with 64_ blas suffix the patched xlahqr2 was using UPPERCASE function names, and the probes during arpack configure were using the C compiler, sgemm_ and cheev_ need to enable c preprocessor, and disable syntax error on long lines SPQR also needed -DSUN64 (backport of 1ef22d21e5581ac9f2b80b7de6183f8c77e8a56e) --- deps/Makefile | 38 +++- deps/openblas-symbol-rename.patch | 333 ++++++++++++++++++++++++++++++ 2 files changed, 366 insertions(+), 5 deletions(-) create mode 100644 deps/openblas-symbol-rename.patch diff --git a/deps/Makefile b/deps/Makefile index 1b5f82a1ecdbc..9e90378ccc001 100644 --- a/deps/Makefile +++ b/deps/Makefile @@ -791,7 +791,10 @@ endif # 64-bit BLAS interface ifeq ($(USE_BLAS64), 1) -OPENBLAS_BUILD_OPTS += INTERFACE64=1 +OPENBLAS_BUILD_OPTS += INTERFACE64=1 SYMBOLSUFFIX="64_" +ifeq ($(OS),Darwin) +OPENBLAS_BUILD_OPTS += OBJCONV=$(JULIAHOME)/deps/objconv/objconv +endif endif # Decide whether to build for 32-bit or 64-bit arch @@ -827,6 +830,7 @@ endif mkdir -p openblas-$(OPENBLAS_VER) && \ $(TAR) -C openblas-$(OPENBLAS_VER) --strip-components 1 -xf $< perl -i -ple 's/^\s*(EXTRALIB\s*\+=\s*-lSystemStubs)\s*$$/# $$1/g' openblas-$(OPENBLAS_VER)/Makefile.system + cd openblas-$(OPENBLAS_VER) && patch -p1 < ../openblas-symbol-rename.patch echo 1 > $@ $(OPENBLAS_OBJ_SOURCE): openblas-$(OPENBLAS_VER)/config.status $(MAKE) -C openblas-$(OPENBLAS_VER) $(OPENBLAS_BUILD_OPTS) || (echo "*** Clean the OpenBLAS build with 'make -C deps clean-openblas'. Rebuild with 'make OPENBLAS_USE_THREAD=0 if OpenBLAS had trouble linking libpthread.so, and with 'make OPENBLAS_TARGET_ARCH=NEHALEM' if there were errors building SandyBridge support. Both these options can also be used simultaneously. ***" && false) @@ -989,12 +993,28 @@ install-lapack: $(LAPACK_OBJ_TARGET) ## ARPACK ## ARPACK_FFLAGS = $(GFORTBLAS_FFLAGS) +ARPACK_CFLAGS = ifeq ($(USE_BLAS64), 1) ifeq ($(USEIFC),1) ARPACK_FFLAGS += -i8 else ARPACK_FFLAGS += -fdefault-integer-8 +ifeq ($(USE_SYSTEM_BLAS), 0) +ifneq ($(USE_INTEL_MKL), 1) +ARPACK_FFLAGS += -cpp -ffixed-line-length-none +ARPACK_OPENBLASFCNS1 = axpy copy gemv geqr2 lacpy lahqr lanhs larnv lartg lascl laset scal trevc trmm trsen +ARPACK_OPENBLASFCNS2 = dot ger labad laev2 lamch lanst lanv2 lapy2 larf larfg lasr nrm2 orm2r rot steqr swap +ARPACK_OPENBLASFCNS3 = dotc geru unm2r +ARPACK_OPENBLASFCNS4 = COPY LABAD LAMCH LANHS LANV2 LARFG ROT +ARPACK_FFLAGS += $(foreach fcn, $(ARPACK_OPENBLASFCNS1) $(ARPACK_OPENBLASFCNS2), -Ds$(fcn)=s$(fcn)_64 -Dd$(fcn)=d$(fcn)_64) +ARPACK_FFLAGS += $(foreach fcn, $(ARPACK_OPENBLASFCNS1) $(ARPACK_OPENBLASFCNS3), -Dc$(fcn)=c$(fcn)_64 -Dz$(fcn)=z$(fcn)_64) +ARPACK_FFLAGS += $(foreach fcn, $(ARPACK_OPENBLASFCNS4), -DS$(fcn)=S$(fcn)_64 -DD$(fcn)=D$(fcn)_64) +ARPACK_FFLAGS += -Dscnrm2=scnrm2_64 -Ddznrm2=dznrm2_64 -Dcsscal=csscal_64 -Dzdscal=zdscal_64 +# CFLAGS are for the configure checks +ARPACK_CFLAGS += -Dsgemm_=sgemm_64_ -Dcheev_=cheev_64_ +endif +endif endif endif @@ -1007,7 +1027,7 @@ ARPACK_OBJ_TARGET = $(build_shlibdir)/libarpack.$(SHLIB_EXT) ARPACK_MFLAGS = F77="$(FC)" MPIF77="$(FC)" ARPACK_FFLAGS += $(FFLAGS) $(JFFLAGS) -ARPACK_FLAGS = --with-blas="$(LIBBLAS)" --with-lapack="$(LIBLAPACK)" --disable-mpi --enable-shared FFLAGS="$(ARPACK_FFLAGS)" +ARPACK_FLAGS = --with-blas="$(LIBBLAS)" --with-lapack="$(LIBLAPACK)" --disable-mpi --enable-shared FFLAGS="$(ARPACK_FFLAGS)" CFLAGS="$(ARPACK_CFLAGS)" ifneq ($(OS),WINNT) ARPACK_FLAGS += LDFLAGS="$(LDFLAGS) -Wl,-rpath,'$(build_libdir)'" endif @@ -1249,8 +1269,16 @@ SUITESPARSE_OBJ_SOURCE = SuiteSparse-$(SUITESPARSE_VER)/UMFPACK/Lib/libumfpack.a SUITESPARSE_OBJ_TARGET = $(build_shlibdir)/libspqr.$(SHLIB_EXT) ifeq ($(USE_BLAS64), 1) -UMFPACK_CONFIG = -DLONGBLAS='long long' -CHOLMOD_CONFIG = -DLONGBLAS='long long' +UMFPACK_CONFIG = -DLONGBLAS='long long' +CHOLMOD_CONFIG = -DLONGBLAS='long long' +SPQR_CONFIG = -DLONGBLAS='long long' +ifeq ($(USE_SYSTEM_BLAS), 0) +ifneq ($(USE_INTEL_MKL), 1) +UMFPACK_CONFIG += -DSUN64 +CHOLMOD_CONFIG += -DSUN64 +SPQR_CONFIG += -DSUN64 +endif +endif endif SUITE_SPARSE_LIB = -lm @@ -1264,7 +1292,7 @@ SUITE_SPARSE_LIB += -Wl,-rpath,'$(build_libdir)' endif SUITESPARSE_MFLAGS = CC="$(CC)" CXX="$(CXX)" F77="$(FC)" AR="$(AR)" RANLIB="$(RANLIB)" BLAS="$(LIBBLAS)" LAPACK="$(LIBLAPACK)" \ INSTALL_LIB="$(build_libdir)" INSTALL_INCLUDE="$(build_includedir)" LIB="$(SUITE_SPARSE_LIB)" \ - UMFPACK_CONFIG="$(UMFPACK_CONFIG)" CHOLMOD_CONFIG="$(CHOLMOD_CONFIG)" + UMFPACK_CONFIG="$(UMFPACK_CONFIG)" CHOLMOD_CONFIG="$(CHOLMOD_CONFIG)" SPQR_CONFIG="$(SPQR_CONFIG)" SuiteSparse-$(SUITESPARSE_VER).tar.gz: $(JLDOWNLOAD) $@ http://faculty.cse.tamu.edu/davis/SuiteSparse/$@ diff --git a/deps/openblas-symbol-rename.patch b/deps/openblas-symbol-rename.patch new file mode 100644 index 0000000000000..c5ed9a1b85cf8 --- /dev/null +++ b/deps/openblas-symbol-rename.patch @@ -0,0 +1,333 @@ +diff --git a/Makefile.system b/Makefile.system +index d2ff741..ec6339d 100644 +--- a/Makefile.system ++++ b/Makefile.system +@@ -186,6 +186,8 @@ LD = $(CROSS_SUFFIX)ld + RANLIB = $(CROSS_SUFFIX)ranlib + NM = $(CROSS_SUFFIX)nm + DLLWRAP = $(CROSS_SUFFIX)dllwrap ++OBJCOPY = $(CROSS_SUFFIX)objcopy ++OBJCONV = $(CROSS_SUFFIX)objconv + + # + # OS dependent settings +@@ -845,6 +847,14 @@ else + LIBPREFIX = libopenblas_$(LIBNAMESUFFIX) + endif + ++ifndef SYMBOLPREFIX ++SYMBOLPREFIX = ++endif ++ ++ifndef SYMBOLSUFFIX ++SYMBOLSUFFIX = ++endif ++ + KERNELDIR = $(TOPDIR)/kernel/$(ARCH) + + include $(TOPDIR)/Makefile.$(ARCH) +diff --git a/exports/Makefile b/exports/Makefile +index c798bc7..f2f6881 100644 +--- a/exports/Makefile ++++ b/exports/Makefile +@@ -88,12 +88,18 @@ dll : ../$(LIBDLLNAME) + -Wl,--whole-archive ../$(LIBNAME) -Wl,--no-whole-archive $(FEXTRALIB) $(EXTRALIB) + + libopenblas.def : gensymbol +- perl ./gensymbol win2k $(ARCH) dummy $(EXPRECISION) $(NO_CBLAS) $(NO_LAPACK) $(NO_LAPACKE) $(NEED2UNDERSCORES) $(ONLY_CBLAS) > $(@F) ++ perl ./gensymbol win2k $(ARCH) dummy $(EXPRECISION) $(NO_CBLAS) $(NO_LAPACK) $(NO_LAPACKE) $(NEED2UNDERSCORES) $(ONLY_CBLAS) "$(SYMBOLPREFIX)" "$(SYMBOLSUFFIX)" > $(@F) + + libgoto_hpl.def : gensymbol +- perl ./gensymbol win2khpl $(ARCH) dummy $(EXPRECISION) $(NO_CBLAS) $(NO_LAPACK) $(NO_LAPACKE) $(NEED2UNDERSCORES) $(ONLY_CBLAS) > $(@F) ++ perl ./gensymbol win2khpl $(ARCH) dummy $(EXPRECISION) $(NO_CBLAS) $(NO_LAPACK) $(NO_LAPACKE) $(NEED2UNDERSCORES) $(ONLY_CBLAS) "$(SYMBOLPREFIX)" "$(SYMBOLSUFFIX)" > $(@F) + ++ifeq (, $(SYMBOLPREFIX)$(SYMBOLSUFFIX)) + $(LIBDYNNAME) : ../$(LIBNAME) osx.def ++else ++../$(LIBNAME).renamed : ../$(LIBNAME) objconv.def ++ $(OBJCONV) @objconv.def ../$(LIBNAME) ../$(LIBNAME).renamed ++$(LIBDYNNAME) : ../$(LIBNAME).renamed osx.def ++endif + $(FC) $(FFLAGS) -all_load -headerpad_max_install_names -install_name $(CURDIR)/../$(LIBDYNNAME) -dynamiclib -o ../$(LIBDYNNAME) $< -Wl,-exported_symbols_list,osx.def $(FEXTRALIB) + + dllinit.$(SUFFIX) : dllinit.c +@@ -103,16 +109,22 @@ ifeq ($(OSNAME), Linux) + + so : ../$(LIBSONAME) + ++ifeq (, $(SYMBOLPREFIX)$(SYMBOLSUFFIX)) + ../$(LIBSONAME) : ../$(LIBNAME) linktest.c ++else ++../$(LIBNAME).renamed : ../$(LIBNAME) objcopy.def ++ $(OBJCOPY) --redefine-syms objcopy.def ../$(LIBNAME) ../$(LIBNAME).renamed ++../$(LIBSONAME) : ../$(LIBNAME).renamed linktest.c ++endif + ifneq ($(C_COMPILER), LSB) + $(CC) $(CFLAGS) $(LDFLAGS) -shared -o ../$(LIBSONAME) \ +- -Wl,--whole-archive ../$(LIBNAME) -Wl,--no-whole-archive \ ++ -Wl,--whole-archive $< -Wl,--no-whole-archive \ + -Wl,-soname,$(LIBPREFIX).so.$(MAJOR_VERSION) $(EXTRALIB) + $(CC) $(CFLAGS) $(LDFLAGS) -w -o linktest linktest.c ../$(LIBSONAME) $(FEXTRALIB) && echo OK. + else + #for LSB + env LSBCC_SHAREDLIBS=gfortran $(CC) $(CFLAGS) $(LDFLAGS) -shared -o ../$(LIBSONAME) \ +- -Wl,--whole-archive ../$(LIBNAME) -Wl,--no-whole-archive \ ++ -Wl,--whole-archive $< -Wl,--no-whole-archive \ + -Wl,-soname,$(LIBPREFIX).so.$(MAJOR_VERSION) $(EXTRALIB) + $(FC) $(CFLAGS) $(LDFLAGS) -w -o linktest linktest.c ../$(LIBSONAME) $(FEXTRALIB) && echo OK. + endif +@@ -125,9 +137,15 @@ ifeq ($(OSNAME), $(filter $(OSNAME),FreeBSD NetBSD)) + + so : ../$(LIBSONAME) + ++ifeq (, $(SYMBOLPREFIX)$(SYMBOLSUFFIX)) + ../$(LIBSONAME) : ../$(LIBNAME) linktest.c ++else ++../$(LIBNAME).renamed : ../$(LIBNAME) objcopy.def ++ $(OBJCOPY) --redefine-syms objcopy.def ../$(LIBNAME) ../$(LIBNAME).renamed ++../$(LIBSONAME) : ../$(LIBNAME).renamed linktest.c ++endif + $(CC) $(CFLAGS) $(LDFLAGS) -shared -o ../$(LIBSONAME) \ +- -Wl,--whole-archive ../$(LIBNAME) -Wl,--no-whole-archive \ ++ -Wl,--whole-archive $< -Wl,--no-whole-archive \ + $(FEXTRALIB) $(EXTRALIB) + $(CC) $(CFLAGS) $(LDFLAGS) -w -o linktest linktest.c ../$(LIBSONAME) $(FEXTRALIB) && echo OK. + rm -f linktest +@@ -178,17 +196,23 @@ static : ../$(LIBNAME) + rm -f goto.$(SUFFIX) + + osx.def : gensymbol ../Makefile.system ../getarch.c +- perl ./gensymbol osx $(ARCH) $(BU) $(EXPRECISION) $(NO_CBLAS) $(NO_LAPACK) $(NO_LAPACKE) $(NEED2UNDERSCORES) $(ONLY_CBLAS) > $(@F) ++ perl ./gensymbol osx $(ARCH) $(BU) $(EXPRECISION) $(NO_CBLAS) $(NO_LAPACK) $(NO_LAPACKE) $(NEED2UNDERSCORES) $(ONLY_CBLAS) "$(SYMBOLPREFIX)" "$(SYMBOLSUFFIX)" > $(@F) + + aix.def : gensymbol ../Makefile.system ../getarch.c +- perl ./gensymbol aix $(ARCH) $(BU) $(EXPRECISION) $(NO_CBLAS) $(NO_LAPACK) $(NO_LAPACKE) $(NEED2UNDERSCORES) $(ONLY_CBLAS) > $(@F) ++ perl ./gensymbol aix $(ARCH) $(BU) $(EXPRECISION) $(NO_CBLAS) $(NO_LAPACK) $(NO_LAPACKE) $(NEED2UNDERSCORES) $(ONLY_CBLAS) "$(SYMBOLPREFIX)" "$(SYMBOLSUFFIX)" > $(@F) ++ ++objcopy.def : gensymbol ../Makefile.system ../getarch.c ++ perl ./gensymbol objcopy $(ARCH) $(BU) $(EXPRECISION) $(NO_CBLAS) $(NO_LAPACK) $(NO_LAPACKE) $(NEED2UNDERSCORES) $(ONLY_CBLAS) "$(SYMBOLPREFIX)" "$(SYMBOLSUFFIX)" > $(@F) ++ ++objconv.def : gensymbol ../Makefile.system ../getarch.c ++ perl ./gensymbol objconv $(ARCH) $(BU) $(EXPRECISION) $(NO_CBLAS) $(NO_LAPACK) $(NO_LAPACKE) $(NEED2UNDERSCORES) $(ONLY_CBLAS) "$(SYMBOLPREFIX)" "$(SYMBOLSUFFIX)" > $(@F) + + test : linktest.c + $(CC) $(CFLAGS) $(LDFLAGS) -w -o linktest linktest.c ../$(LIBSONAME) -lm && echo OK. + rm -f linktest + + linktest.c : gensymbol ../Makefile.system ../getarch.c +- perl ./gensymbol linktest $(ARCH) $(BU) $(EXPRECISION) $(NO_CBLAS) $(NO_LAPACK) $(NO_LAPACKE) $(NEED2UNDERSCORES) $(ONLY_CBLAS) > linktest.c ++ perl ./gensymbol linktest $(ARCH) $(BU) $(EXPRECISION) $(NO_CBLAS) $(NO_LAPACK) $(NO_LAPACKE) $(NEED2UNDERSCORES) $(ONLY_CBLAS) "$(SYMBOLPREFIX)" "$(SYMBOLSUFFIX)" > linktest.c + + clean :: + @rm -f *.def *.dylib __.SYMDEF* +diff --git a/exports/gensymbol b/exports/gensymbol +index bcea836..8bd2f17 100644 +--- a/exports/gensymbol ++++ b/exports/gensymbol +@@ -2784,22 +2784,26 @@ $bu = $ARGV[2]; + + $bu = "" if (($bu eq "0") || ($bu eq "1")); + ++$symbolprefix = $ARGV[9]; ++ ++$symbolsuffix = $ARGV[10]; ++ + if ($ARGV[0] eq "osx"){ + + @underscore_objs = (@underscore_objs, @misc_common_objs); + @no_underscore_objs = (@no_underscore_objs, @misc_common_objs); + + foreach $objs (@underscore_objs) { +- print "_", $objs, $bu, "\n"; ++ print "_", $symbolprefix, $objs, $bu, $symbolsuffix, "\n"; + } + + foreach $objs (@need_2underscore_objs) { +- print "_", $objs, $bu, $bu, "\n"; ++ print "_", $symbolprefix, $objs, $bu, $bu, $symbolsuffix, "\n"; + } + + # if ($ARGV[4] == 0) { + foreach $objs (@no_underscore_objs) { +- print "_", $objs, "\n"; ++ print "_", $symbolprefix, $objs, $symbolsuffix, "\n"; + } + # } + exit(0); +@@ -2811,16 +2815,58 @@ if ($ARGV[0] eq "aix"){ + @no_underscore_objs = (@no_underscore_objs, @misc_common_objs); + + foreach $objs (@underscore_objs) { +- print $objs, $bu, "\n"; ++ print $symbolprefix, $objs, $bu, $symbolsuffix, "\n"; ++ } ++ ++ foreach $objs (@need_2underscore_objs) { ++ print $symbolprefix, $objs, $bu, $bu, $symbolsuffix, "\n"; ++ } ++ ++# if ($ARGV[4] == 0) { ++ foreach $objs (@no_underscore_objs) { ++ print $symbolprefix, $objs, $symbolsuffix, "\n"; ++ } ++# } ++ exit(0); ++} ++ ++if ($ARGV[0] eq "objcopy"){ ++ ++ @underscore_objs = (@underscore_objs, @misc_common_objs); ++ @no_underscore_objs = (@no_underscore_objs, @misc_common_objs); ++ ++ foreach $objs (@underscore_objs) { ++ print $objs, $bu, " ", $symbolprefix, $objs, $bu, $symbolsuffix, "\n"; ++ } ++ ++ foreach $objs (@need_2underscore_objs) { ++ print $objs, $bu, $bu, " ", $symbolprefix, $objs, $bu, $bu, $symbolsuffix, "\n"; ++ } ++ ++# if ($ARGV[4] == 0) { ++ foreach $objs (@no_underscore_objs) { ++ print $objs, " ", $symbolprefix, $objs, $symbolsuffix, "\n"; ++ } ++# } ++ exit(0); ++} ++ ++if ($ARGV[0] eq "objconv"){ ++ ++ @underscore_objs = (@underscore_objs, @misc_common_objs); ++ @no_underscore_objs = (@no_underscore_objs, @misc_common_objs); ++ ++ foreach $objs (@underscore_objs) { ++ print "-nr:_", $objs, $bu, ":_", $symbolprefix, $objs, $bu, $symbolsuffix, "\n"; + } + + foreach $objs (@need_2underscore_objs) { +- print $objs, $bu, $bu, "\n"; ++ print "-nr:_", $objs, $bu, $bu, ":_", $symbolprefix, $objs, $bu, $bu, $symbolsuffix, "\n"; + } + + # if ($ARGV[4] == 0) { + foreach $objs (@no_underscore_objs) { +- print $objs, "\n"; ++ print "-nr:_", $objs, ":_", $symbolprefix, $objs, $symbolsuffix, "\n"; + } + # } + exit(0); +@@ -2835,22 +2881,22 @@ if ($ARGV[0] eq "win2k"){ + foreach $objs (@underscore_objs) { + $uppercase = $objs; + $uppercase =~ tr/[a-z]/[A-Z]/; +- print "\t$objs=$objs","_ \@", $count, "\n"; ++ print "\t",$symbolprefix, $objs, $symbolsuffix, "=$objs","_ \@", $count, "\n"; + $count ++; +- print "\t",$objs, "_=$objs","_ \@", $count, "\n"; ++ print "\t",$symbolprefix, $objs, "_", $symbolsuffix, "=$objs","_ \@", $count, "\n"; + $count ++; +- print "\t$uppercase=$objs", "_ \@", $count, "\n"; ++ print "\t",$symbolprefix, $uppercase, $symbolsuffix, "=$objs", "_ \@", $count, "\n"; + $count ++; + } + + foreach $objs (@need_2underscore_objs) { + $uppercase = $objs; + $uppercase =~ tr/[a-z]/[A-Z]/; +- print "\t$objs=$objs","__ \@", $count, "\n"; ++ print "\t",$symbolprefix, $objs, $symbolsuffix, "=$objs","__ \@", $count, "\n"; + $count ++; +- print "\t",$objs, "__=$objs","__ \@", $count, "\n"; ++ print "\t",$symbolprefix, $objs, "__", $symbolsuffix, "=$objs","__ \@", $count, "\n"; + $count ++; +- print "\t$uppercase=$objs", "__ \@", $count, "\n"; ++ print "\t",$symbolprefix, $uppercase, $symbolsuffix, "=$objs", "__ \@", $count, "\n"; + $count ++; + } + +@@ -2859,15 +2905,15 @@ if ($ARGV[0] eq "win2k"){ + + $uppercase = $objs; + $uppercase =~ tr/[a-z]/[A-Z]/; +- print "\t",$objs, "_=$objs","_ \@", $count, "\n"; ++ print "\t",$symbolprefix, $objs, "_", $symbolsuffix, "=$objs","_ \@", $count, "\n"; + $count ++; +- print "\t$uppercase=$objs", "_ \@", $count, "\n"; ++ print "\t",$symbolprefix, $uppercase, $symbolsuffix, "=$objs", "_ \@", $count, "\n"; + $count ++; + } + + + foreach $objs (@no_underscore_objs) { +- print "\t",$objs,"=$objs"," \@", $count, "\n"; ++ print "\t",$symbolprefix,$objs,$symbolsuffix,"=$objs"," \@", $count, "\n"; + $count ++; + } + +@@ -2880,11 +2926,11 @@ if ($ARGV[0] eq "win2khpl"){ + foreach $objs (@hplobjs) { + $uppercase = $objs; + $uppercase =~ tr/[a-z]/[A-Z]/; +- print "\t$objs=$objs","_ \@", $count, "\n"; ++ print "\t",$symbolprefix, $objs, $symbolsuffix, "=$objs","_ \@", $count, "\n"; + $count ++; +- print "\t",$objs, "_=$objs","_ \@", $count, "\n"; ++ print "\t",$symbolprefix, $objs, "_", $symbolsuffix, "=$objs","_ \@", $count, "\n"; + $count ++; +- print "\t$uppercase=$objs", "_ \@", $count, "\n"; ++ print "\t",$symbolprefix, $uppercase, $symbolsuffix, "=$objs", "_ \@", $count, "\n"; + $count ++; + } + +@@ -2905,24 +2951,24 @@ if ($ARGV[0] eq "microsoft"){ + foreach $objs (@underscore_objs) { + $uppercase = $objs; + $uppercase =~ tr/[a-z]/[A-Z]/; +- print "\t$objs = $objs","_\n"; ++ print "\t",$symbolprefix, $objs, $symbolsuffix, " = $objs","_\n"; + $count ++; +- print "\t$objs\_ = $objs","_\n"; ++ print "\t",$symbolprefix, $objs, "\_", $symbolsuffix, " = $objs","_\n"; + $count ++; +- print "\t$uppercase = $objs","_\n"; ++ print "\t",$symbolprefix, $uppercase, $symbolsuffix, " = $objs","_\n"; + $count ++; +- print "\t$uppercase\_ = $objs","_\n"; ++ print "\t",$symbolprefix, $uppercase, "\_", $symbolsuffix, " = $objs","_\n"; + $count ++; + } + + foreach $objs (@need_2underscore_objs) { + $uppercase = $objs; + $uppercase =~ tr/[a-z]/[A-Z]/; +- print "\t$objs=$objs","__ \@", $count, "\n"; ++ print "\t",$symbolprefix, $objs, $symbolsuffix, "=$objs","__ \@", $count, "\n"; + $count ++; +- print "\t",$objs, "__=$objs","__ \@", $count, "\n"; ++ print "\t",$symbolprefix, $objs, "__", $symbolsuffix, "=$objs","__ \@", $count, "\n"; + $count ++; +- print "\t$uppercase=$objs", "__ \@", $count, "\n"; ++ print "\t",$symbolprefix, $uppercase, $symbolsuffix, "=$objs", "__ \@", $count, "\n"; + $count ++; + } + +@@ -2936,16 +2982,16 @@ if ($ARGV[0] eq "linktest"){ + + print "int main(void){\n"; + foreach $objs (@underscore_objs) { +- print $objs, $bu, "();\n" if $objs ne "xerbla"; ++ print $symbolprefix, $objs, $bu, $symbolsuffix, "();\n" if $objs ne "xerbla"; + } + + foreach $objs (@need_2underscore_objs) { +- print $objs, $bu, $bu, "();\n"; ++ print $symbolprefix, $objs, $bu, $bu, $symbolsuffix, "();\n"; + } + + # if ($ARGV[4] == 0) { + foreach $objs (@no_underscore_objs) { +- print $objs, "();\n"; ++ print $symbolprefix, $objs, $symbolsuffix, "();\n"; + } + # } + From 12797dbc365a9fc192cfd92bfae0c2836544fb44 Mon Sep 17 00:00:00 2001 From: Tony Kelman Date: Sun, 19 Oct 2014 13:59:55 -0700 Subject: [PATCH 2/5] add a separate blas_vendor for suffixed openblas (backport of 7f596d460944bd85ddf7379b70f37507ae3eda8c) --- base/interactiveutil.jl | 2 +- base/util.jl | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/base/interactiveutil.jl b/base/interactiveutil.jl index 8bfa3e3718cd8..634cd990b9bf2 100644 --- a/base/interactiveutil.jl +++ b/base/interactiveutil.jl @@ -172,7 +172,7 @@ function versioninfo(io::IO=STDOUT, verbose::Bool=false) Sys.cpu_summary(io) println(io ) end - if Base.libblas_name == "libopenblas" || blas_vendor() == :openblas + if Base.libblas_name == "libopenblas" || blas_vendor() == :openblas || blas_vendor() == :openblas64 openblas_config = openblas_get_config() println(io, " BLAS: libopenblas (", openblas_config, ")") else diff --git a/base/util.jl b/base/util.jl index f593231ac73a0..421856b62dbf3 100644 --- a/base/util.jl +++ b/base/util.jl @@ -107,6 +107,10 @@ function blas_vendor() cglobal((:openblas_set_num_threads, Base.libblas_name), Void) return :openblas end + try + cglobal((:openblas_set_num_threads64_, Base.libblas_name), Void) + return :openblas64 + end try cglobal((:MKL_Set_Num_Threads, Base.libblas_name), Void) return :mkl @@ -114,12 +118,18 @@ function blas_vendor() return :unknown end -openblas_get_config() = strip(bytestring( ccall((:openblas_get_config, Base.libblas_name), Ptr{Uint8}, () ))) +if blas_vendor() == :openblas64 + openblas_get_config() = strip(bytestring( ccall((:openblas_get_config64_, Base.libblas_name), Ptr{Uint8}, () ))) +else + openblas_get_config() = strip(bytestring( ccall((:openblas_get_config, Base.libblas_name), Ptr{Uint8}, () ))) +end function blas_set_num_threads(n::Integer) blas = blas_vendor() if blas == :openblas return ccall((:openblas_set_num_threads, Base.libblas_name), Void, (Int32,), n) + elseif blas == :openblas64 + return ccall((:openblas_set_num_threads64_, Base.libblas_name), Void, (Int32,), n) elseif blas == :mkl # MKL may let us set the number of threads in several ways return ccall((:MKL_Set_Num_Threads, Base.libblas_name), Void, (Cint,), n) @@ -133,7 +143,7 @@ end function check_blas() blas = blas_vendor() - if blas == :openblas + if blas == :openblas || blas == :openblas64 openblas_config = openblas_get_config() openblas64 = ismatch(r".*USE64BITINT.*", openblas_config) if Base.USE_BLAS64 != openblas64 From bd9b63a9c183a672e962c680b6ce71e7bc181b03 Mon Sep 17 00:00:00 2001 From: Tony Kelman Date: Mon, 17 Nov 2014 23:45:02 -0800 Subject: [PATCH 3/5] add blasfunc for appending suffix to all blas and lapack symbols (manual backport of 02ff76249c3f43247b9898db9edee48af73f1229) --- base/linalg/blas.jl | 79 +++++++------- base/linalg/lapack.jl | 232 +++++++++++++++++++++--------------------- base/util.jl | 2 + 3 files changed, 159 insertions(+), 154 deletions(-) diff --git a/base/linalg/blas.jl b/base/linalg/blas.jl index b0a233b67f06b..ea60a287440b9 100644 --- a/base/linalg/blas.jl +++ b/base/linalg/blas.jl @@ -1,6 +1,7 @@ module BLAS -import Base.copy! +import Base: copy!, blasfunc + export # Level 1 asum, @@ -43,14 +44,14 @@ import ..LinAlg: BlasReal, BlasComplex, BlasFloat, BlasChar, BlasInt, blas_int, # Level 1 ## copy -for (fname, elty) in ((:dcopy_,:Float64), +for (fname, elty) in ((:dcopy_,:Float64), (:scopy_,:Float32), - (:zcopy_,:Complex128), + (:zcopy_,:Complex128), (:ccopy_,:Complex64)) @eval begin # SUBROUTINE DCOPY(N,DX,INCX,DY,INCY) function blascopy!(n::Integer, DX::Union(Ptr{$elty},Array{$elty}), incx::Integer, DY::Union(Ptr{$elty},Array{$elty}), incy::Integer) - ccall(($(string(fname)),libblas), Void, + ccall(($(blasfunc(fname)), libblas), Void, (Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}), &n, DX, &incx, DY, &incy) DY @@ -59,14 +60,14 @@ for (fname, elty) in ((:dcopy_,:Float64), end ## scal -for (fname, elty) in ((:dscal_,:Float64), +for (fname, elty) in ((:dscal_,:Float64), (:sscal_,:Float32), - (:zscal_,:Complex128), + (:zscal_,:Complex128), (:cscal_,:Complex64)) @eval begin # SUBROUTINE DSCAL(N,DA,DX,INCX) function scal!(n::Integer, DA::$elty, DX::Union(Ptr{$elty},Array{$elty}), incx::Integer) - ccall(($(string(fname)),libblas), Void, + ccall(($(blasfunc(fname)), libblas), Void, (Ptr{BlasInt}, Ptr{$elty}, Ptr{$elty}, Ptr{BlasInt}), &n, &DA, DX, &incx) DX @@ -79,7 +80,7 @@ for (fname, elty, celty) in ((:sscal_, :Float32, :Complex64), (:dscal_, :Float64, :Complex128)) @eval begin function scal!(n::Integer, DA::$elty, DX::Union(Ptr{$celty},Array{$celty}), incx::Integer) - ccall(($(string(fname)),libblas), Void, + ccall(($(blasfunc(fname)), libblas), Void, (Ptr{BlasInt}, Ptr{$elty}, Ptr{$celty}, Ptr{BlasInt}), &(2*n), &DA, DX, &incx) DX @@ -88,7 +89,7 @@ for (fname, elty, celty) in ((:sscal_, :Float32, :Complex64), end ## dot -for (fname, elty) in ((:ddot_,:Float64), +for (fname, elty) in ((:ddot_,:Float64), (:sdot_,:Float32)) @eval begin # DOUBLE PRECISION FUNCTION DDOT(N,DX,INCX,DY,INCY) @@ -98,7 +99,7 @@ for (fname, elty) in ((:ddot_,:Float64), # * .. Array Arguments .. # DOUBLE PRECISION DX(*),DY(*) function dot(n::Integer, DX::Union(Ptr{$elty},Array{$elty}), incx::Integer, DY::Union(Ptr{$elty},Array{$elty}), incy::Integer) - ccall(($(string(fname)),libblas), $elty, + ccall(($(blasfunc(fname)), libblas), $elty, (Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}), &n, DX, &incx, DY, &incy) end @@ -115,7 +116,7 @@ for (fname, elty) in ((:cblas_zdotc_sub,:Complex128), # DOUBLE PRECISION DX(*),DY(*) function dotc(n::Integer, DX::Union(Ptr{$elty},Array{$elty}), incx::Integer, DY::Union(Ptr{$elty},Array{$elty}), incy::Integer) result = Array($elty, 1) - ccall(($(string(fname)),libblas), $elty, + ccall(($(blasfunc(fname)), libblas), $elty, (BlasInt, Ptr{$elty}, BlasInt, Ptr{$elty}, BlasInt, Ptr{$elty}), n, DX, incx, DY, incy, result) result[1] @@ -133,7 +134,7 @@ for (fname, elty) in ((:cblas_zdotu_sub,:Complex128), # DOUBLE PRECISION DX(*),DY(*) function dotu(n::Integer, DX::Union(Ptr{$elty},Array{$elty}), incx::Integer, DY::Union(Ptr{$elty},Array{$elty}), incy::Integer) result = Array($elty, 1) - ccall(($(string(fname)),libblas), $elty, + ccall(($(blasfunc(fname)), libblas), $elty, (BlasInt, Ptr{$elty}, BlasInt, Ptr{$elty}, BlasInt, Ptr{$elty}), n, DX, incx, DY, incy, result) result[1] @@ -164,7 +165,7 @@ for (fname, elty, ret_type) in ((:dnrm2_,:Float64,:Float64), @eval begin # SUBROUTINE DNRM2(N,X,INCX) function nrm2(n::Integer, X::Union(Ptr{$elty},StridedVector{$elty}), incx::Integer) - ccall(($(string(fname)),libblas), $ret_type, + ccall(($(blasfunc(fname)), libblas), $ret_type, (Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}), &n, X, &incx) end @@ -181,7 +182,7 @@ for (fname, elty, ret_type) in ((:dasum_,:Float64,:Float64), @eval begin # SUBROUTINE ASUM(N, X, INCX) function asum(n::Integer, X::Union(Ptr{$elty},StridedVector{$elty}), incx::Integer) - ccall(($(string(fname)),libblas), $ret_type, + ccall(($(blasfunc(fname)), libblas), $ret_type, (Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}), &n, X, &incx) end @@ -204,7 +205,7 @@ for (fname, elty) in ((:daxpy_,:Float64), #* .. Array Arguments .. # DOUBLE PRECISION DX(*),DY(*) function axpy!(n::Integer, alpha::($elty), dx::Union(Ptr{$elty},Array{$elty}), incx::Integer, dy::Union(Ptr{$elty},Array{$elty}), incy::Integer) - ccall(($(string(fname)),libblas), Void, + ccall(($(blasfunc(fname)), libblas), Void, (Ptr{BlasInt}, Ptr{$elty}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}), &n, &alpha, dx, &incx, dy, &incy) dy @@ -235,7 +236,7 @@ for (fname, elty) in ((:idamax_,:Float64), (:icamax_,:Complex64)) @eval begin function iamax(n::BlasInt, dx::Union(StridedVector{$elty}, Ptr{$elty}), incx::BlasInt) - ccall(($(string(fname)), libblas),BlasInt, + ccall(($(blasfunc(fname)), libblas),BlasInt, (Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}), &n, dx, &incx) end @@ -261,7 +262,7 @@ for (fname, elty) in ((:dgemv_,:Float64), function gemv!(trans::BlasChar, alpha::($elty), A::StridedVecOrMat{$elty}, X::StridedVector{$elty}, beta::($elty), Y::StridedVector{$elty}) m,n = size(A,1),size(A,2) length(X) == (trans == 'N' ? n : m) && length(Y) == (trans == 'N' ? m : n) || throw(DimensionMismatch("")) - ccall(($(string(fname)),libblas), Void, + ccall(($(blasfunc(fname)), libblas), Void, (Ptr{Uint8}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$elty}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{$elty}, Ptr{BlasInt}), @@ -280,9 +281,9 @@ for (fname, elty) in ((:dgemv_,:Float64), end ### (GB) general banded matrix-vector multiplication -for (fname, elty) in ((:dgbmv_,:Float64), +for (fname, elty) in ((:dgbmv_,:Float64), (:sgbmv_,:Float32), - (:zgbmv_,:Complex128), + (:zgbmv_,:Complex128), (:cgbmv_,:Complex64)) @eval begin # SUBROUTINE DGBMV(TRANS,M,N,KL,KU,ALPHA,A,LDA,X,INCX,BETA,Y,INCY) @@ -293,7 +294,7 @@ for (fname, elty) in ((:dgbmv_,:Float64), # * .. Array Arguments .. # DOUBLE PRECISION A(LDA,*),X(*),Y(*) function gbmv!(trans::BlasChar, m::Integer, kl::Integer, ku::Integer, alpha::($elty), A::StridedMatrix{$elty}, x::StridedVector{$elty}, beta::($elty), y::StridedVector{$elty}) - ccall(($(string(fname)),libblas), Void, + ccall(($(blasfunc(fname)), libblas), Void, (Ptr{Uint8}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$elty}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{$elty}, @@ -332,7 +333,7 @@ for (fname, elty) in ((:dsymv_,:Float64), m, n = size(A) if m != n throw(DimensionMismatch("Matrix A is $m by $n but must be square")) end if m != length(x) || m != length(y) throw(DimensionMismatch("")) end - ccall(($(string(fname)),libblas), Void, + ccall(($(blasfunc(fname)), libblas), Void, (Ptr{Uint8}, Ptr{BlasInt}, Ptr{$elty}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{$elty}, Ptr{BlasInt}), @@ -351,9 +352,9 @@ for (fname, elty) in ((:dsymv_,:Float64), end ### sbmv, (SB) symmetric banded matrix-vector multiplication -for (fname, elty) in ((:dsbmv_,:Float64), +for (fname, elty) in ((:dsbmv_,:Float64), (:ssbmv_,:Float32), - (:zsbmv_,:Complex128), + (:zsbmv_,:Complex128), (:csbmv_,:Complex64)) @eval begin # SUBROUTINE DSBMV(UPLO,N,K,ALPHA,A,LDA,X,INCX,BETA,Y,INCY) @@ -364,7 +365,7 @@ for (fname, elty) in ((:dsbmv_,:Float64), # * .. Array Arguments .. # DOUBLE PRECISION A(LDA,*),X(*),Y(*) function sbmv!(uplo::BlasChar, k::Integer, alpha::($elty), A::StridedMatrix{$elty}, x::StridedVector{$elty}, beta::($elty), y::StridedVector{$elty}) - ccall(($(string(fname)),libblas), Void, + ccall(($(blasfunc(fname)), libblas), Void, (Ptr{Uint8}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$elty}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{$elty}, Ptr{BlasInt}), @@ -400,7 +401,7 @@ for (fname, elty) in ((:dtrmv_,:Float64), if n != length(x) throw(DimensionMismatch("length(x)=$(length(x))does not match size(A)=$(size(A))")) end - ccall(($(string(fname)), libblas), Void, + ccall(($(blasfunc(fname)), libblas), Void, (Ptr{Uint8}, Ptr{Uint8}, Ptr{Uint8}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}), &uplo, &trans, &diag, &n, @@ -427,7 +428,7 @@ for (fname, elty) in ((:dtrsv_,:Float64), function trsv!(uplo::Char, trans::Char, diag::Char, A::StridedMatrix{$elty}, x::StridedVector{$elty}) n = chksquare(A) n==length(x) || throw(DimensionMismatch("size of A is $n != length(x) = $(length(x))")) - ccall(($(string(fname)), libblas), Void, + ccall(($(blasfunc(fname)), libblas), Void, (Ptr{Uint8}, Ptr{Uint8}, Ptr{Uint8}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}), &uplo, &trans, &diag, &n, @@ -450,7 +451,7 @@ for (fname, elty) in ((:dger_,:Float64), m, n = size(A) m == length(x) || throw(DimensionMismatch("")) n == length(y) || throw(DimensionMismatch("")) - ccall(($(string(fname)), libblas), Void, + ccall(($(blasfunc(fname)), libblas), Void, (Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$elty}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}), @@ -471,7 +472,7 @@ for (fname, elty) in ((:dsyr_,:Float64), function syr!(uplo::Char, α::$elty, x::StridedVector{$elty}, A::StridedMatrix{$elty}) n = chksquare(A) length(x) == n || throw(DimensionMismatch("Length of vector must be the same as the matrix dimensions")) - ccall(($(string(fname)), libblas), Void, + ccall(($(blasfunc(fname)), libblas), Void, (Ptr{Uint8}, Ptr{BlasInt}, Ptr{$elty}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}), &uplo, &n, &α, x, @@ -488,7 +489,7 @@ for (fname, elty) in ((:zher_,:Complex128), function her!(uplo::Char, α::$elty, x::StridedVector{$elty}, A::StridedMatrix{$elty}) n = chksquare(A) length(x) == A || throw(DimensionMismatch("Length of vector must be the same as the matrix dimensions")) - ccall(($(string(fname)), libblas), Void, + ccall(($(blasfunc(fname)), libblas), Void, (Ptr{Uint8}, Ptr{BlasInt}, Ptr{$elty}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}), &uplo, &n, &α, x, @@ -523,7 +524,7 @@ for (gemm, elty) in if m != size(C,1) || n != size(C,2) throw(DimensionMismatch("")) end - ccall(($(string(gemm)),libblas), Void, + ccall(($(blasfunc(gemm)), libblas), Void, (Ptr{Uint8}, Ptr{Uint8}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$elty}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{$elty}, @@ -560,7 +561,7 @@ for (mfname, elty) in ((:dsymm_,:Float64), m, n = size(C) j = chksquare(A) if j != (side == 'L' ? m : n) || size(B,2) != n throw(DimensionMismatch("")) end - ccall(($(string(mfname)),libblas), Void, + ccall(($(blasfunc(mfname)), libblas), Void, (Ptr{Uint8}, Ptr{Uint8}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$elty}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{$elty}, Ptr{BlasInt}), @@ -598,7 +599,7 @@ for (fname, elty) in ((:dsyrk_,:Float64), nn = size(A, trans == 'N' ? 1 : 2) if nn != n throw(DimensionMismatch("syrk!")) end k = size(A, trans == 'N' ? 2 : 1) - ccall(($(string(fname)),libblas), Void, + ccall(($(blasfunc(fname)), libblas), Void, (Ptr{Uint8}, Ptr{Uint8}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$elty}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{$elty}, Ptr{BlasInt}), @@ -631,7 +632,7 @@ for (fname, elty) in ((:zherk_,:Complex128), (:cherk_,:Complex64)) n = chksquare(C) n == size(A, trans == 'N' ? 1 : 2) || throw(DimensionMismatch("herk!")) k = size(A, trans == 'N' ? 2 : 1) - ccall(($(string(fname)),libblas), Void, + ccall(($(blasfunc(fname)), libblas), Void, (Ptr{Uint8}, Ptr{Uint8}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$elty}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{$elty}, Ptr{BlasInt}), @@ -670,7 +671,7 @@ for (fname, elty) in ((:dsyr2k_,:Float64), nn = size(A, trans == 'N' ? 1 : 2) if nn != n throw(DimensionMismatch("syr2k!")) end k = size(A, trans == 'N' ? 2 : 1) - ccall(($(string(fname)),Base.libblas_name), Void, + ccall(($(blasfunc(fname)),Base.libblas_name), Void, (Ptr{Uint8}, Ptr{Uint8}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$elty}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{$elty}, Ptr{BlasInt}), @@ -706,7 +707,7 @@ for (fname, elty1, elty2) in ((:zher2k_,:Complex128,:Float64), (:cher2k_,:Comple n = chksquare(C) n == size(A, trans == 'N' ? 1 : 2) || throw(DimensionMismatch("her2k!")) k = size(A, trans == 'N' ? 2 : 1) - ccall(($(string(fname)),libblas), Void, + ccall(($(blasfunc(fname)), libblas), Void, (Ptr{Uint8}, Ptr{Uint8}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$elty1}, Ptr{$elty1}, Ptr{BlasInt}, Ptr{$elty1}, Ptr{BlasInt}, Ptr{$elty2}, Ptr{$elty1}, Ptr{BlasInt}), @@ -737,7 +738,7 @@ for (fname, elty) in ((:dgbmv_,:Float64), (:sgbmv_,:Float32), function gbmv!(trans::BlasChar, m::Integer, kl::Integer, ku::Integer, alpha::($elty), A::StridedMatrix{$elty}, x::StridedVector{$elty}, beta::($elty), y::StridedVector{$elty}) - ccall(($(string(fname)),libblas), Void, + ccall(($(blasfunc(fname)), libblas), Void, (Ptr{Uint8}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$elty}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{$elty}, Ptr{BlasInt}), @@ -772,7 +773,7 @@ for (fname, elty) in ((:dsbmv_,:Float64), (:ssbmv_,:Float32), function sbmv!(uplo::BlasChar, k::Integer, alpha::($elty), A::StridedMatrix{$elty}, x::StridedVector{$elty}, beta::($elty), y::StridedVector{$elty}) - ccall(($(string(fname)),libblas), Void, + ccall(($(blasfunc(fname)), libblas), Void, (Ptr{Uint8}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$elty}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{$elty}, Ptr{BlasInt}), &uplo, &size(A,2), &k, &alpha, A, &max(1,stride(A,2)), x, &stride(x,1), @@ -809,7 +810,7 @@ for (mmname, smname, elty) in m, n = size(B) nA = chksquare(A) if nA != (side == 'L' ? m : n) throw(DimensionMismatch("trmm!")) end - ccall(($(string(mmname)), libblas), Void, + ccall(($(blasfunc(mmname)), libblas), Void, (Ptr{Uint8}, Ptr{Uint8}, Ptr{Uint8}, Ptr{Uint8}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$elty}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}), &side, &uplo, &transa, &diag, &m, &n, @@ -832,7 +833,7 @@ for (mmname, smname, elty) in m, n = size(B) k = chksquare(A) k==(side == 'L' ? m : n) || throw(DimensionMismatch("size of A is $n, size(B)=($m,$n) and transa='$transa'")) - ccall(($(string(smname)), libblas), Void, + ccall(($(blasfunc(smname)), libblas), Void, (Ptr{Uint8}, Ptr{Uint8}, Ptr{Uint8}, Ptr{Uint8}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$elty}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}), diff --git a/base/linalg/lapack.jl b/base/linalg/lapack.jl index 248a0a7e6ead0..b705ae4e4ed1a 100644 --- a/base/linalg/lapack.jl +++ b/base/linalg/lapack.jl @@ -3,6 +3,8 @@ module LAPACK const liblapack = Base.liblapack_name +import Base.blasfunc + import ..LinAlg: BlasFloat, BlasChar, BlasInt, blas_int, LAPACKException, DimensionMismatch, SingularException, PosDefException, chkstride1, chksquare @@ -47,7 +49,7 @@ for (gbtrf, gbtrs, elty) in n = size(AB, 2) mnmn = min(m, n) ipiv = similar(AB, BlasInt, mnmn) - ccall(($(string(gbtrf)),liblapack), Void, + ccall(($(blasfunc(gbtrf)), liblapack), Void, (Ptr{BlasInt}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{BlasInt}), &m, &n, &kl, &ku, AB, &max(1,stride(AB,2)), ipiv, info) @@ -68,7 +70,7 @@ for (gbtrf, gbtrs, elty) in info = Array(BlasInt, 1) n = size(AB,2) if m != n || m != size(B,1) throw(DimensionMismatch("gbtrs!")) end - ccall(($(string(gbtrs)),liblapack), Void, + ccall(($(blasfunc(gbtrs)), liblapack), Void, (Ptr{BlasChar}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{BlasInt}), @@ -100,7 +102,7 @@ for (gebal, gebak, elty, relty) in ihi = Array(BlasInt, 1) ilo = Array(BlasInt, 1) scale = similar(A, $relty, n) - ccall(($(string(gebal)),liblapack), Void, + ccall(($(blasfunc(gebal)), liblapack), Void, (Ptr{BlasChar}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$relty}, Ptr{BlasInt}), &job, &n, A, &max(1,stride(A,2)), ilo, ihi, scale, info) @@ -119,7 +121,7 @@ for (gebal, gebak, elty, relty) in chkstride1(V) chksquare(V) info = Array(BlasInt, 1) - ccall(($(string(gebak)),liblapack), Void, + ccall(($(blasfunc(gebak)), liblapack), Void, (Ptr{BlasChar}, Ptr{BlasChar}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{BlasInt}), &job, &side, &size(V,1), &ilo, &ihi, scale, &n, V, &max(1,stride(V,2)), info) @@ -170,7 +172,7 @@ for (gebrd, gelqf, geqlf, geqrf, geqp3, geqrt, geqrt3, gerqf, getrf, elty, relty lwork = blas_int(-1) info = Array(BlasInt, 1) for i in 1:2 - ccall(($(string(gebrd)),liblapack), Void, + ccall(($(blasfunc(gebrd)), liblapack), Void, (Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{$elty}, Ptr{$elty}, Ptr{$elty}, Ptr{$elty}, Ptr{BlasInt}, Ptr{BlasInt}), @@ -198,7 +200,7 @@ for (gebrd, gelqf, geqlf, geqrf, geqp3, geqrt, geqrt3, gerqf, getrf, elty, relty lwork = blas_int(-1) work = Array($elty, (1,)) for i in 1:2 # first call returns lwork as work[1] - ccall(($(string(gelqf)),liblapack), Void, + ccall(($(blasfunc(gelqf)), liblapack), Void, (Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{$elty}, Ptr{BlasInt}, Ptr{BlasInt}), &m, &n, A, &lda, tau, work, &lwork, info) @@ -225,7 +227,7 @@ for (gebrd, gelqf, geqlf, geqrf, geqp3, geqrt, geqrt3, gerqf, getrf, elty, relty lwork = blas_int(-1) work = Array($elty, (1,)) for i in 1:2 # first call returns lwork as work[1] - ccall(($(string(geqlf)),liblapack), Void, + ccall(($(blasfunc(geqlf)), liblapack), Void, (Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{$elty}, Ptr{BlasInt}, Ptr{BlasInt}), &m, &n, A, &lda, tau, work, &lwork, info) @@ -256,7 +258,7 @@ for (gebrd, gelqf, geqlf, geqrf, geqp3, geqrt, geqrt3, gerqf, getrf, elty, relty if cmplx; rwork = Array($relty, 2n); end for i in 1:2 if cmplx - ccall(($(string(geqp3)),liblapack), Void, + ccall(($(blasfunc(geqp3)), liblapack), Void, (Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$elty}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$relty}, Ptr{BlasInt}), @@ -264,7 +266,7 @@ for (gebrd, gelqf, geqlf, geqrf, geqp3, geqrt, geqrt3, gerqf, getrf, elty, relty jpvt, tau, work, &lwork, rwork, info) else - ccall(($(string(geqp3)),liblapack), Void, + ccall(($(blasfunc(geqp3)), liblapack), Void, (Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$elty}, Ptr{$elty}, Ptr{BlasInt}, Ptr{BlasInt}), @@ -290,7 +292,7 @@ for (gebrd, gelqf, geqlf, geqrf, geqp3, geqrt, geqrt3, gerqf, getrf, elty, relty work = Array($elty, nb*n) if n > 0 info = Array(BlasInt, 1) - ccall(($(string(geqrt)), liblapack), Void, + ccall(($(blasfunc(geqrt)), liblapack), Void, (Ptr{BlasInt}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}), @@ -308,7 +310,7 @@ for (gebrd, gelqf, geqlf, geqrf, geqp3, geqrt, geqrt3, gerqf, getrf, elty, relty if p < n || q < n throw(DimensionMismatch("block reflector")) end if n > 0 info = Array(BlasInt, 1) - ccall(($(string(geqrt3)), liblapack), Void, + ccall(($(blasfunc(geqrt3)), liblapack), Void, (Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{BlasInt}), &m, &n, A, &max(1, stride(A, 2)), @@ -331,7 +333,7 @@ for (gebrd, gelqf, geqlf, geqrf, geqp3, geqrt, geqrt3, gerqf, getrf, elty, relty lwork = blas_int(-1) info = Array(BlasInt, 1) for i in 1:2 # first call returns lwork as work[1] - ccall(($(string(geqrf)),liblapack), Void, + ccall(($(blasfunc(geqrf)), liblapack), Void, (Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{$elty}, Ptr{BlasInt}, Ptr{BlasInt}), &m, &n, A, &max(1,stride(A,2)), tau, work, &lwork, info) @@ -356,7 +358,7 @@ for (gebrd, gelqf, geqlf, geqrf, geqp3, geqrt, geqrt3, gerqf, getrf, elty, relty lwork = blas_int(-1) work = Array($elty, 1) for i in 1:2 # first call returns lwork as work[1] - ccall(($(string(gerqf)),liblapack), Void, + ccall(($(blasfunc(gerqf)), liblapack), Void, (Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{$elty}, Ptr{BlasInt}, Ptr{BlasInt}), &m, &n, A, &max(1,stride(A,2)), tau, work, &lwork, info) @@ -380,7 +382,7 @@ for (gebrd, gelqf, geqlf, geqrf, geqp3, geqrt, geqrt3, gerqf, getrf, elty, relty m, n = size(A) lda = max(1,stride(A, 2)) ipiv = similar(A, BlasInt, min(m,n)) - ccall(($(string(getrf)),liblapack), Void, + ccall(($(blasfunc(getrf)), liblapack), Void, (Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{BlasInt}), &m, &n, A, &lda, ipiv, info) @@ -429,7 +431,7 @@ for (tzrzf, ormrz, elty) in lwork = -1 info = Array(BlasInt, 1) for i = 1:2 - ccall(($(string(tzrzf)), liblapack), Void, + ccall(($(blasfunc(tzrzf)), liblapack), Void, (Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{$elty}, Ptr{BlasInt}, Ptr{BlasInt}), &m, &n, A, &lda, @@ -461,7 +463,7 @@ for (tzrzf, ormrz, elty) in lwork = -1 info = Array(BlasInt, 1) for i = 1:2 - ccall(($(string(ormrz)), liblapack), Void, + ccall(($(blasfunc(ormrz)), liblapack), Void, (Ptr{BlasChar}, Ptr{BlasChar}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, @@ -502,7 +504,7 @@ for (gels, gesv, getrs, getri, elty) in work = Array($elty, 1) lwork = blas_int(-1) for i in 1:2 - ccall(($(string(gels)),liblapack), Void, + ccall(($(blasfunc(gels)), liblapack), Void, (Ptr{BlasChar}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{BlasInt}), @@ -538,7 +540,7 @@ for (gels, gesv, getrs, getri, elty) in if size(B,1) != n throw(DimensionMismatch("gesv!")) end ipiv = similar(A, BlasInt, n) info = Array(BlasInt, 1) - ccall(($(string(gesv)),liblapack), Void, + ccall(($(blasfunc(gesv)), liblapack), Void, (Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{BlasInt}), &n, &size(B,2), A, &max(1,stride(A,2)), ipiv, B, &max(1,stride(B,2)), info) @@ -558,7 +560,7 @@ for (gels, gesv, getrs, getri, elty) in n==size(B, 1) || throw(DimensionMismatch("left and right hand sides do not fit")) nrhs = size(B, 2) info = Array(BlasInt, 1) - ccall(($(string(getrs)),liblapack), Void, + ccall(($(blasfunc(getrs)), liblapack), Void, (Ptr{BlasChar}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{BlasInt}), &trans, &n, &size(B,2), A, &max(1,stride(A,2)), ipiv, B, &max(1,stride(B,2)), info) @@ -580,7 +582,7 @@ for (gels, gesv, getrs, getri, elty) in lwork = -1 work = Array($elty, 1) for i in 1:2 - ccall(($(string(getri)),liblapack), Void, + ccall(($(blasfunc(getri)), liblapack), Void, (Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{BlasInt}), &n, A, &lda, ipiv, work, &lwork, info) @@ -626,7 +628,7 @@ for (gesvx, elty) in iwork = Array($elty, n) info = Array(BlasInt, 1) X = similar(A, $elty, n, nrhs) - ccall(($(string(gesvx)),liblapack), Void, + ccall(($(blasfunc(gesvx)), liblapack), Void, (Ptr{BlasChar}, Ptr{BlasChar}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{BlasChar}, Ptr{$elty}, Ptr{$elty}, Ptr{$elty}, Ptr{BlasInt}, @@ -681,7 +683,7 @@ for (gesvx, elty, relty) in rwork = Array($relty, 2n) info = Array(BlasInt, 1) x = similar(A, $elty, n, nrhs) - ccall(($(string(gesvx)),liblapack), Void, + ccall(($(blasfunc(gesvx)), liblapack), Void, (Ptr{BlasChar}, Ptr{BlasChar}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{BlasChar}, Ptr{$relty}, Ptr{$relty}, Ptr{$elty}, Ptr{BlasInt}, @@ -730,7 +732,7 @@ for (gelsd, gelsy, elty) in lwork = blas_int(-1) iwork = Array(BlasInt, 1) for i in 1:2 - ccall(($(string(gelsd)),liblapack), Void, + ccall(($(blasfunc(gelsd)), liblapack), Void, (Ptr{BlasInt}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, @@ -772,7 +774,7 @@ for (gelsd, gelsy, elty) in lwork = -1 info = Array(BlasInt, 1) for i = 1:2 - ccall(($(string(gelsy)), liblapack), Void, + ccall(($(blasfunc(gelsy)), liblapack), Void, (Ptr{BlasInt}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, @@ -819,7 +821,7 @@ for (gelsd, gelsy, elty, relty) in rwork = Array($relty, 1) iwork = Array(BlasInt, 1) for i in 1:2 - ccall(($(string(gelsd)),liblapack), Void, + ccall(($(blasfunc(gelsd)), liblapack), Void, (Ptr{BlasInt}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$relty}, Ptr{$relty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, @@ -863,7 +865,7 @@ for (gelsd, gelsy, elty, relty) in rwork = Array($relty, 2n) info = Array(BlasInt, 1) for i = 1:2 - ccall(($(string(gelsy)), liblapack), Void, + ccall(($(blasfunc(gelsy)), liblapack), Void, (Ptr{BlasInt}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, @@ -909,7 +911,7 @@ for (gglse, elty) in ((:dgglse_, :Float64), work = Array($elty, 1) lwork = blas_int(-1) for i in 1:2 - ccall(($(string(gglse)),liblapack), Void, + ccall(($(blasfunc(gglse)), liblapack), Void, (Ptr{BlasInt}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{$elty}, Ptr{$elty}, Ptr{$elty}, Ptr{BlasInt}, @@ -962,7 +964,7 @@ for (geev, gesvd, gesdd, ggsvd, elty, relty) in info = Array(BlasInt, 1) for i = 1:2 if cmplx - ccall(($(string(geev)),liblapack), Void, + ccall(($(blasfunc(geev)), liblapack), Void, (Ptr{BlasChar}, Ptr{BlasChar}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, @@ -970,7 +972,7 @@ for (geev, gesvd, gesdd, ggsvd, elty, relty) in &jobvl, &jobvr, &n, A, &max(1,stride(A,2)), W, VL, &n, VR, &n, work, &lwork, rwork, info) else - ccall(($(string(geev)),liblapack), Void, + ccall(($(blasfunc(geev)), liblapack), Void, (Ptr{BlasChar}, Ptr{BlasChar}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{$elty}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, @@ -1025,7 +1027,7 @@ for (geev, gesvd, gesdd, ggsvd, elty, relty) in info = Array(BlasInt, 1) for i = 1:2 if cmplx - ccall(($(string(gesdd)),liblapack), Void, + ccall(($(blasfunc(gesdd)), liblapack), Void, (Ptr{BlasChar}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$relty}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, @@ -1033,7 +1035,7 @@ for (geev, gesvd, gesdd, ggsvd, elty, relty) in &job, &m, &n, A, &max(1,stride(A,2)), S, U, &max(1,stride(U,2)), VT, &max(1,stride(VT,2)), work, &lwork, rwork, iwork, info) else - ccall(($(string(gesdd)),liblapack), Void, + ccall(($(blasfunc(gesdd)), liblapack), Void, (Ptr{BlasChar}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, @@ -1070,7 +1072,7 @@ for (geev, gesvd, gesdd, ggsvd, elty, relty) in info = Array(BlasInt, 1) for i in 1:2 if cmplx - ccall(($(string(gesvd)),liblapack), Void, + ccall(($(blasfunc(gesvd)), liblapack), Void, (Ptr{BlasChar}, Ptr{BlasChar}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, @@ -1078,7 +1080,7 @@ for (geev, gesvd, gesdd, ggsvd, elty, relty) in &jobu, &jobvt, &m, &n, A, &max(1,stride(A,2)), S, U, &max(1,stride(U,2)), VT, &max(1,stride(VT,2)), work, &lwork, rwork, info) else - ccall(($(string(gesvd)),liblapack), Void, + ccall(($(blasfunc(gesvd)), liblapack), Void, (Ptr{BlasChar}, Ptr{BlasChar}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, @@ -1129,7 +1131,7 @@ for (geev, gesvd, gesdd, ggsvd, elty, relty) in iwork = Array(BlasInt, n) info = Array(BlasInt, 1) if cmplx - ccall(($(string(ggsvd)),liblapack), Void, + ccall(($(blasfunc(ggsvd)), liblapack), Void, (Ptr{BlasChar}, Ptr{BlasChar}, Ptr{BlasChar}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, @@ -1143,7 +1145,7 @@ for (geev, gesvd, gesdd, ggsvd, elty, relty) in V, &ldv, Q, &ldq, work, rwork, iwork, info) else - ccall(($(string(ggsvd)),liblapack), Void, + ccall(($(blasfunc(ggsvd)), liblapack), Void, (Ptr{BlasChar}, Ptr{BlasChar}, Ptr{BlasChar}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, @@ -1206,7 +1208,7 @@ for (geevx, ggev, elty) in iwork = Array(BlasInt, sense == 'N' || sense == 'E' ? 0 : (sense == 'V' || sense == 'B' ? 2n-2 : throw(ArgumentError("argument sense must be 'N', 'E', 'V' or 'B'")))) info = Array(BlasInt, 1) for i = 1:2 - ccall(($(string(geevx)),Base.liblapack_name), Void, + ccall(($(blasfunc(geevx)), liblapack), Void, (Ptr{Uint8}, Ptr{Uint8}, Ptr{Uint8}, Ptr{Uint8}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{$elty}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, @@ -1253,7 +1255,7 @@ for (geevx, ggev, elty) in lwork = -one(BlasInt) info = Array(BlasInt, 1) for i = 1:2 - ccall(($(string(ggev)), liblapack), Void, + ccall(($(blasfunc(ggev)), liblapack), Void, (Ptr{BlasChar}, Ptr{BlasChar}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{$elty}, Ptr{$elty}, Ptr{$elty}, Ptr{BlasInt}, @@ -1311,7 +1313,7 @@ for (geevx, ggev, elty, relty) in rwork = Array($relty, 2n) info = Array(BlasInt, 1) for i = 1:2 - ccall(($(string(geevx)),Base.liblapack_name), Void, + ccall(($(blasfunc(geevx)), liblapack), Void, (Ptr{Uint8}, Ptr{Uint8}, Ptr{Uint8}, Ptr{Uint8}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, @@ -1358,7 +1360,7 @@ for (geevx, ggev, elty, relty) in rwork = Array($relty, 8n) info = Array(BlasInt, 1) for i = 1:2 - ccall(($(string(ggev)), liblapack), Void, + ccall(($(blasfunc(ggev)), liblapack), Void, (Ptr{BlasChar}, Ptr{BlasChar}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{$elty}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, @@ -1399,7 +1401,7 @@ for (laic1, elty) in sestpr = Array($elty, 1) s = Array($elty, 1) c = Array($elty, 1) - ccall(($(string(laic1)), liblapack), Void, + ccall(($(blasfunc(laic1)), liblapack), Void, (Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$elty}, Ptr{$elty}, Ptr{$elty}, Ptr{$elty}, Ptr{$elty}, Ptr{$elty}, Ptr{$elty}), @@ -1429,7 +1431,7 @@ for (laic1, elty, relty) in sestpr = Array($relty, 1) s = Array($elty, 1) c = Array($elty, 1) - ccall(($(string(laic1)), liblapack), Void, + ccall(($(blasfunc(laic1)), liblapack), Void, (Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$elty}, Ptr{$relty}, Ptr{$elty}, Ptr{$elty}, Ptr{$relty}, Ptr{$elty}, Ptr{$elty}), @@ -1447,7 +1449,7 @@ for (gtsv, gttrf, gttrs, elty) in ((:dgtsv_,:dgttrf_,:dgttrs_,:Float64), (:sgtsv_,:sgttrf_,:sgttrs_,:Float32), (:zgtsv_,:zgttrf_,:zgttrs_,:Complex128), - (:cgtsv_,:cgttrf_,:cgttrs_,:Complex64)) + (:cgtsv_,:cgttrf_,:cgttrs_,:Complex64)) @eval begin # SUBROUTINE DGTSV( N, NRHS, DL, D, DU, B, LDB, INFO ) # .. Scalar Arguments .. @@ -1463,7 +1465,7 @@ for (gtsv, gttrf, gttrs, elty) in end if n != size(B,1) throw(DimensionMismatch("gtsv!")) end info = Array(BlasInt, 1) - ccall(($(string(gtsv)),liblapack), Void, + ccall(($(blasfunc(gtsv)), liblapack), Void, (Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$elty}, Ptr{$elty}, Ptr{$elty}, Ptr{$elty}, Ptr{BlasInt}, Ptr{BlasInt}), &n, &size(B,2), dl, d, du, B, &max(1,stride(B,2)), info) @@ -1484,7 +1486,7 @@ for (gtsv, gttrf, gttrs, elty) in du2 = similar(d, $elty, n-2) ipiv = similar(d, BlasInt, n) info = Array(BlasInt, 1) - ccall(($(string(gttrf)),liblapack), Void, + ccall(($(blasfunc(gttrf)), liblapack), Void, (Ptr{BlasInt}, Ptr{$elty}, Ptr{$elty}, Ptr{$elty}, Ptr{$elty}, Ptr{BlasInt}, Ptr{BlasInt}), &n, dl, d, du, du2, ipiv, info) @@ -1506,7 +1508,7 @@ for (gtsv, gttrf, gttrs, elty) in if length(dl) != n - 1 || length(du) != n - 1 throw(DimensionMismatch("gttrs!")) end if n != size(B,1) throw(DimensionMismatch("gttrs!")) end info = Array(BlasInt, 1) - ccall(($(string(gttrs)),liblapack), Void, + ccall(($(blasfunc(gttrs)), liblapack), Void, (Ptr{BlasChar}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$elty}, Ptr{$elty}, Ptr{$elty}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{BlasInt}), @@ -1538,7 +1540,7 @@ for (orglq, orgqr, ormlq, ormqr, gemqrt, elty) in lwork = blas_int(-1) info = Array(BlasInt, 1) for i in 1:2 - ccall(($(string(orglq)),liblapack), Void, + ccall(($(blasfunc(orglq)), liblapack), Void, (Ptr{BlasInt}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{$elty}, Ptr{BlasInt}, Ptr{BlasInt}), &m, &n, &k, A, &max(1,stride(A,2)), tau, work, &lwork, info) @@ -1568,7 +1570,7 @@ for (orglq, orgqr, ormlq, ormqr, gemqrt, elty) in lwork = blas_int(-1) info = Array(BlasInt, 1) for i in 1:2 - ccall(($(string(orgqr)),liblapack), Void, + ccall(($(blasfunc(orgqr)), liblapack), Void, (Ptr{BlasInt}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{$elty}, Ptr{BlasInt}, Ptr{BlasInt}), &m, &n, &k, A, @@ -1606,7 +1608,7 @@ for (orglq, orgqr, ormlq, ormqr, gemqrt, elty) in lwork = blas_int(-1) info = Array(BlasInt, 1) for i in 1:2 - ccall(($(string(ormlq)),liblapack), Void, + ccall(($(blasfunc(ormlq)), liblapack), Void, (Ptr{BlasChar}, Ptr{BlasChar}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{BlasInt}), @@ -1640,7 +1642,7 @@ for (orglq, orgqr, ormlq, ormqr, gemqrt, elty) in lwork = blas_int(-1) info = Array(BlasInt, 1) for i in 1:2 - ccall(($(string(ormqr)),liblapack), Void, + ccall(($(blasfunc(ormqr)), liblapack), Void, (Ptr{BlasChar}, Ptr{BlasChar}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, @@ -1679,7 +1681,7 @@ for (orglq, orgqr, ormlq, ormqr, gemqrt, elty) in ldc = max(1, stride(C,2)) work = Array($elty, wss) info = Array(BlasInt, 1) - ccall(($(string(gemqrt)), liblapack), Void, + ccall(($(blasfunc(gemqrt)), liblapack), Void, (Ptr{BlasChar}, Ptr{BlasChar}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, @@ -1714,7 +1716,7 @@ for (posv, potrf, potri, potrs, pstrf, elty, rtyp) in @chkuplo if size(B,1) != n throw(DimensionMismatch("posv!")) end info = Array(BlasInt, 1) - ccall(($(string(posv)),liblapack), Void, + ccall(($(blasfunc(posv)), liblapack), Void, (Ptr{BlasChar}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{BlasInt}), &uplo, &n, &size(B,2), A, &max(1,stride(A,2)), B, &max(1,stride(B,2)), info) @@ -1735,7 +1737,7 @@ for (posv, potrf, potri, potrs, pstrf, elty, rtyp) in lda = max(1,stride(A,2)) lda==0 && return A, 0 info = Array(BlasInt, 1) - ccall(($(string(potrf)),liblapack), Void, + ccall(($(blasfunc(potrf)), liblapack), Void, (Ptr{BlasChar}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{BlasInt}), &uplo, &size(A,1), A, &lda, info) @assertargsok @@ -1754,7 +1756,7 @@ for (posv, potrf, potri, potrs, pstrf, elty, rtyp) in chkstride1(A) @chkuplo info = Array(BlasInt, 1) - ccall(($(string(potri)),liblapack), Void, + ccall(($(blasfunc(potri)), liblapack), Void, (Ptr{BlasChar}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{BlasInt}), &uplo, &size(A,1), A, &max(1,stride(A,2)), info) @assertargsok @@ -1777,7 +1779,7 @@ for (posv, potrf, potri, potrs, pstrf, elty, rtyp) in if lda == 0 || nrhs == 0 return B end ldb = max(1,stride(B,2)) info = Array(BlasInt, 1) - ccall(($(string(potrs)),liblapack), Void, + ccall(($(blasfunc(potrs)), liblapack), Void, (Ptr{BlasChar}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{BlasInt}), &uplo, &n, &nrhs, A, @@ -1801,7 +1803,7 @@ for (posv, potrf, potri, potrs, pstrf, elty, rtyp) in rank = Array(BlasInt, 1) work = Array($rtyp, 2n) info = Array(BlasInt, 1) - ccall(($(string(pstrf)),liblapack), Void, + ccall(($(blasfunc(pstrf)), liblapack), Void, (Ptr{BlasChar}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$rtyp}, Ptr{$rtyp}, Ptr{BlasInt}), &uplo, &n, A, &max(1,stride(A,2)), piv, rank, &tol, work, info) @@ -1815,8 +1817,8 @@ end ## Direct solvers for general tridiagonal and symmetric positive-definite tridiagonal for (ptsv, pttrf, pttrs, elty, relty) in ((:dptsv_,:dpttrf_,:dpttrs_,:Float64,:Float64), - (:sptsv_,:spttrf_,:spttrs_,:Float32,:Float32), - (:zptsv_,:zpttrf_,:zpttrs_,:Complex128,:Float64), + (:sptsv_,:spttrf_,:spttrs_,:Float32,:Float32), + (:zptsv_,:zpttrf_,:zpttrs_,:Complex128,:Float64), (:cptsv_,:cpttrf_,:cpttrs_,:Complex64,:Float32)) @eval begin # SUBROUTINE DPTSV( N, NRHS, D, E, B, LDB, INFO ) @@ -1829,7 +1831,7 @@ for (ptsv, pttrf, pttrs, elty, relty) in n = length(D) if length(E) != n - 1 || n != size(B,1) throw(DimensionMismatch("ptsv!")) end info = Array(BlasInt, 1) - ccall(($(string(ptsv)),liblapack), Void, + ccall(($(blasfunc(ptsv)), liblapack), Void, (Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$relty}, Ptr{$elty}, Ptr{$elty}, Ptr{BlasInt}, Ptr{BlasInt}), &n, &size(B,2), D, E, B, &max(1,stride(B,2)), info) @@ -1845,7 +1847,7 @@ for (ptsv, pttrf, pttrs, elty, relty) in n = length(D) if length(E) != (n-1) throw(DimensionMismatch("pttrf!")) end info = Array(BlasInt, 1) - ccall(($(string(pttrf)),liblapack), Void, + ccall(($(blasfunc(pttrf)), liblapack), Void, (Ptr{BlasInt}, Ptr{$relty}, Ptr{$elty}, Ptr{BlasInt}), &n, D, E, info) @lapackerror @@ -1867,7 +1869,7 @@ for (pttrs, elty, relty) in n = length(D) if length(E) != (n-1) || size(B,1) != n throw(DimensionMismatch("pttrs!")) end info = Array(BlasInt, 1) - ccall(($(string(pttrs)),liblapack), Void, + ccall(($(blasfunc(pttrs)), liblapack), Void, (Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$relty}, Ptr{$elty}, Ptr{$elty}, Ptr{BlasInt}, Ptr{BlasInt}), &n, &size(B,2), D, E, B, &max(1,stride(B,2)), info) @@ -1894,7 +1896,7 @@ for (pttrs, elty, relty) in n = length(D) if length(E) != (n-1) || size(B,1) != n throw(DimensionMismatch("pttrs!")) end info = Array(BlasInt, 1) - ccall(($(string(pttrs)),liblapack), Void, + ccall(($(blasfunc(pttrs)), liblapack), Void, (Ptr{BlasChar}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$relty}, Ptr{$elty}, Ptr{$elty}, Ptr{BlasInt}, Ptr{BlasInt}), &uplo, &n, &size(B,2), D, E, B, &max(1,stride(B,2)), info) @@ -1923,7 +1925,7 @@ for (trtri, trtrs, elty) in @chkuplo lda = max(1,stride(A, 2)) info = Array(BlasInt, 1) - ccall(($(string(trtri)),liblapack), Void, + ccall(($(blasfunc(trtri)), liblapack), Void, (Ptr{BlasChar}, Ptr{BlasChar}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{BlasInt}), &uplo, &diag, &n, A, &lda, info) @@ -1943,7 +1945,7 @@ for (trtri, trtrs, elty) in @chkuplo size(B,1)==n || throw(DimensionMismatch("")) info = Array(BlasInt, 1) - ccall(($(string(trtrs)),liblapack), Void, + ccall(($(blasfunc(trtrs)), liblapack), Void, (Ptr{BlasChar}, Ptr{BlasChar}, Ptr{BlasChar}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{BlasInt}), &uplo, &trans, &diag, &n, &size(B,2), A, &max(1,stride(A,2)), @@ -1977,7 +1979,7 @@ for (trcon, trevc, trrfs, elty) in work = Array($elty, 3n) iwork = Array(BlasInt, n) info = Array(BlasInt, 1) - ccall(($(string(trcon)),liblapack), Void, + ccall(($(blasfunc(trcon)), liblapack), Void, (Ptr{BlasChar}, Ptr{BlasChar}, Ptr{BlasChar}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{$elty}, Ptr{BlasInt}, Ptr{BlasInt}), &norm, &uplo, &diag, &n, @@ -2007,7 +2009,7 @@ for (trcon, trevc, trrfs, elty) in m = Array(BlasInt, 1) work = Array($elty, 3n) info = Array(BlasInt, 1) - ccall(($(string(trevc)),liblapack), Void, + ccall(($(blasfunc(trevc)), liblapack), Void, (Ptr{BlasChar}, Ptr{BlasChar}, Ptr{Bool}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}), @@ -2053,7 +2055,7 @@ for (trcon, trevc, trrfs, elty) in work=Array($elty, 3n) iwork=Array(BlasInt, n) info=Array(BlasInt, 1) - ccall(($(string(trrfs)),liblapack), Void, + ccall(($(blasfunc(trrfs)), liblapack), Void, (Ptr{BlasChar}, Ptr{BlasChar}, Ptr{BlasChar}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{$elty}, Ptr{$elty}, Ptr{BlasInt}, Ptr{BlasInt}), @@ -2087,7 +2089,7 @@ for (trcon, trevc, trrfs, elty, relty) in work = Array($elty, 2n) rwork = Array($relty, n) info = Array(BlasInt, 1) - ccall(($(string(trcon)),liblapack), Void, + ccall(($(blasfunc(trcon)), liblapack), Void, (Ptr{BlasChar}, Ptr{BlasChar}, Ptr{BlasChar}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$relty}, Ptr{$elty}, Ptr{$relty}, Ptr{BlasInt}), &norm, &uplo, &diag, &n, @@ -2120,7 +2122,7 @@ for (trcon, trevc, trrfs, elty, relty) in work = Array($elty, 2n) rwork = Array($relty, n) info = Array(BlasInt, 1) - ccall(($(string(trevc)),liblapack), Void, + ccall(($(blasfunc(trevc)), liblapack), Void, (Ptr{BlasChar}, Ptr{BlasChar}, Ptr{Bool}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$elty}, Ptr{$relty}, Ptr{BlasInt}), @@ -2167,7 +2169,7 @@ for (trcon, trevc, trrfs, elty, relty) in work=Array($elty, 2n) rwork=Array($relty, n) info=Array(BlasInt, 1) - ccall(($(string(trrfs)),liblapack), Void, + ccall(($(blasfunc(trrfs)), liblapack), Void, (Ptr{BlasChar}, Ptr{BlasChar}, Ptr{BlasChar}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$relty}, Ptr{$relty}, Ptr{$elty}, Ptr{$relty}, Ptr{BlasInt}), @@ -2196,7 +2198,7 @@ for (stev, stebz, stegr, stein, elty) in Zmat = similar(dv, $elty, (n, job != 'N' ? n : 0)) work = Array($elty, max(1, 2n-2)) info = Array(BlasInt, 1) - ccall(($(string(stev)),liblapack), Void, + ccall(($(blasfunc(stev)), liblapack), Void, (Ptr{BlasChar}, Ptr{BlasInt}, Ptr{$elty}, Ptr{$elty}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}), &job, &n, dv, ev, Zmat, &n, work, info) @@ -2219,7 +2221,7 @@ for (stev, stebz, stegr, stein, elty) in work = Array($elty, 4*n) iwork = Array(BlasInt,3*n) info = Array(BlasInt, 1) - ccall(($(string(stebz)),liblapack), Void, + ccall(($(blasfunc(stebz)), liblapack), Void, (Ptr{BlasChar}, Ptr{BlasChar}, Ptr{BlasInt}, Ptr{$elty}, Ptr{$elty}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$elty}, Ptr{$elty}, Ptr{$elty}, Ptr{BlasInt}, Ptr{BlasInt}, @@ -2257,7 +2259,7 @@ for (stev, stebz, stegr, stein, elty) in liwork = -one(BlasInt) info = Array(BlasInt, 1) for i = 1:2 - ccall(($(string(stegr)), liblapack), Void, + ccall(($(blasfunc(stegr)), liblapack), Void, (Ptr{BlasChar}, Ptr{BlasChar}, Ptr{BlasInt}, Ptr{$elty}, Ptr{$elty}, Ptr{$elty}, Ptr{$elty}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, @@ -2316,7 +2318,7 @@ for (stev, stebz, stegr, stein, elty) in ifail = Array(BlasInt,m) info = Array(BlasInt,1) - ccall(($(string(stein)),liblapack), Void, + ccall(($(blasfunc(stein)), liblapack), Void, (Ptr{BlasInt}, Ptr{$elty}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{BlasInt}, @@ -2355,7 +2357,7 @@ for (syconv, sysv, sytrf, sytri, sytrs, elty) in @chkuplo work = Array($elty, n) info = Array(BlasInt, 1) - ccall(($(string(syconv)),liblapack), Void, + ccall(($(blasfunc(syconv)), liblapack), Void, (Ptr{BlasChar}, Ptr{BlasChar}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}), &uplo, &'C', &n, A, &max(1,stride(A,2)), ipiv, work, info) @@ -2380,7 +2382,7 @@ for (syconv, sysv, sytrf, sytri, sytrs, elty) in lwork = blas_int(-1) info = Array(BlasInt, 1) for i in 1:2 - ccall(($(string(sysv)),liblapack), Void, + ccall(($(blasfunc(sysv)), liblapack), Void, (Ptr{BlasChar}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{BlasInt}), &uplo, &n, &size(B,2), A, &max(1,stride(A,2)), ipiv, B, &max(1,stride(B,2)), @@ -2411,7 +2413,7 @@ for (syconv, sysv, sytrf, sytri, sytrs, elty) in lwork = blas_int(-1) info = Array(BlasInt, 1) for i in 1:2 - ccall(($(string(sytrf)),liblapack), Void, + ccall(($(blasfunc(sytrf)), liblapack), Void, (Ptr{BlasChar}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{BlasInt}), &uplo, &n, A, &stride(A,2), ipiv, work, &lwork, info) @@ -2439,7 +2441,7 @@ for (syconv, sysv, sytrf, sytri, sytrs, elty) in # lwork = blas_int(-1) # info = Array(BlasInt, 1) # for i in 1:2 -# ccall(($(string(sytri)),liblapack), Void, +# ccall(($(blasfunc(sytri)), liblapack), Void, # (Ptr{BlasChar}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, # Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{BlasInt}), # &uplo, &n, A, &max(1,stride(A,2)), ipiv, work, &lwork, info) @@ -2465,7 +2467,7 @@ for (syconv, sysv, sytrf, sytri, sytrs, elty) in @chkuplo work = Array($elty, n) info = Array(BlasInt, 1) - ccall(($(string(sytri)),liblapack), Void, + ccall(($(blasfunc(sytri)), liblapack), Void, (Ptr{BlasChar}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}), &uplo, &n, A, &max(1,stride(A,2)), ipiv, work, info) @@ -2488,7 +2490,7 @@ for (syconv, sysv, sytrf, sytri, sytrs, elty) in @chkuplo if n != size(B,1) throw(DimensionMismatch("sytrs!")) end info = Array(BlasInt, 1) - ccall(($(string(sytrs)),liblapack), Void, + ccall(($(blasfunc(sytrs)), liblapack), Void, (Ptr{BlasChar}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{BlasInt}), &uplo, &n, &size(B,2), A, &max(1,stride(A,2)), ipiv, B, &max(1,stride(B,2)), info) @@ -2518,7 +2520,7 @@ for (syconv, hesv, hetrf, hetri, hetrs, elty, relty) in @chkuplo work = Array($elty, n) info = Array(BlasInt, 1) - ccall(($(string(syconv)),liblapack), Void, + ccall(($(blasfunc(syconv)), liblapack), Void, (Ptr{BlasChar}, Ptr{BlasChar}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}), &uplo, &'C', &n, A, &max(1,stride(A,2)), ipiv, work, info) @@ -2543,7 +2545,7 @@ for (syconv, hesv, hetrf, hetri, hetrs, elty, relty) in lwork = blas_int(-1) info = Array(BlasInt, 1) for i in 1:2 - ccall(($(string(hesv)),liblapack), Void, + ccall(($(blasfunc(hesv)), liblapack), Void, (Ptr{BlasChar}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{BlasInt}), &uplo, &n, &size(B,2), A, &max(1,stride(A,2)), ipiv, B, &max(1,stride(B,2)), @@ -2573,7 +2575,7 @@ for (syconv, hesv, hetrf, hetri, hetrs, elty, relty) in lwork = blas_int(-1) info = Array(BlasInt, 1) for i in 1:2 - ccall(($(string(hetrf)),liblapack), Void, + ccall(($(blasfunc(hetrf)), liblapack), Void, (Ptr{BlasChar}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{BlasInt}), &uplo, &n, A, &max(1,stride(A,2)), ipiv, work, &lwork, info) @@ -2602,7 +2604,7 @@ for (syconv, hesv, hetrf, hetri, hetrs, elty, relty) in # lwork = blas_int(-1) # info = Array(BlasInt, 1) # for i in 1:2 -# ccall(($(string(hetri)),liblapack), Void, +# ccall(($(blasfunc(hetri)), liblapack), Void, # (Ptr{BlasChar}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, # Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{BlasInt}), # &uplo, &n, A, &max(1,stride(A,2)), ipiv, work, &lwork, info) @@ -2628,7 +2630,7 @@ for (syconv, hesv, hetrf, hetri, hetrs, elty, relty) in @chkuplo work = Array($elty, n) info = Array(BlasInt, 1) - ccall(($(string(hetri)),liblapack), Void, + ccall(($(blasfunc(hetri)), liblapack), Void, (Ptr{BlasChar}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}), &uplo, &n, A, &max(1,stride(A,2)), ipiv, work, info) @@ -2649,7 +2651,7 @@ for (syconv, hesv, hetrf, hetri, hetrs, elty, relty) in n = chksquare(A) if n != size(B,1) throw(DimensionMismatch("hetrs!")) end info = Array(BlasInt, 1) - ccall(($(string(hetrs)),liblapack), Void, + ccall(($(blasfunc(hetrs)), liblapack), Void, (Ptr{BlasChar}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{BlasInt}), &uplo, &n, &size(B,2), A, &max(1,stride(A,2)), ipiv, B, &max(1,stride(B,2)), info) @@ -2681,7 +2683,7 @@ for (sysv, sytrf, sytri, sytrs, elty, relty) in lwork = blas_int(-1) info = Array(BlasInt, 1) for i in 1:2 - ccall(($(string(sysv)),liblapack), Void, + ccall(($(blasfunc(sysv)), liblapack), Void, (Ptr{BlasChar}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{BlasInt}), &uplo, &n, &size(B,2), A, &max(1,stride(A,2)), ipiv, B, &max(1,stride(B,2)), @@ -2712,7 +2714,7 @@ for (sysv, sytrf, sytri, sytrs, elty, relty) in lwork = blas_int(-1) info = Array(BlasInt, 1) for i in 1:2 - ccall(($(string(sytrf)),liblapack), Void, + ccall(($(blasfunc(sytrf)), liblapack), Void, (Ptr{BlasChar}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{BlasInt}), &uplo, &n, A, &max(1,stride(A,2)), ipiv, work, &lwork, info) @@ -2741,7 +2743,7 @@ for (sysv, sytrf, sytri, sytrs, elty, relty) in # lwork = blas_int(-1) # info = Array(BlasInt, 1) # for i in 1:2 -# ccall(($(string(sytri)),liblapack), Void, +# ccall(($(blasfunc(sytri)), liblapack), Void, # (Ptr{BlasChar}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, # Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{BlasInt}), # &uplo, &n, A, &max(1,stride(A,2)), ipiv, work, &lwork, info) @@ -2767,7 +2769,7 @@ for (sysv, sytrf, sytri, sytrs, elty, relty) in @chkuplo work = Array($elty, n) info = Array(BlasInt, 1) - ccall(($(string(sytri)),liblapack), Void, + ccall(($(blasfunc(sytri)), liblapack), Void, (Ptr{BlasChar}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}), &uplo, &n, A, &max(1,stride(A,2)), ipiv, work, info) @@ -2789,7 +2791,7 @@ for (sysv, sytrf, sytri, sytrs, elty, relty) in @chkuplo if n != size(B,1) throw(DimensionMismatch("sytrs!")) end info = Array(BlasInt, 1) - ccall(($(string(sytrs)),liblapack), Void, + ccall(($(blasfunc(sytrs)), liblapack), Void, (Ptr{BlasChar}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{BlasInt}), &uplo, &n, &size(B,2), A, &max(1,stride(A,2)), ipiv, B, &max(1,stride(B,2)), info) @@ -2818,7 +2820,7 @@ for (syev, syevr, sygvd, elty) in lwork = blas_int(-1) info = Array(BlasInt, 1) for i in 1:2 - ccall(($(string(syev)),liblapack), Void, + ccall(($(blasfunc(syev)), liblapack), Void, (Ptr{BlasChar}, Ptr{BlasChar}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{$elty}, Ptr{BlasInt}, Ptr{BlasInt}), &jobz, &uplo, &n, A, &max(1,stride(A,2)), W, work, &lwork, info) @@ -2867,7 +2869,7 @@ for (syev, syevr, sygvd, elty) in liwork = blas_int(-1) info = Array(BlasInt, 1) for i in 1:2 - ccall(($(string(syevr)),liblapack), Void, + ccall(($(blasfunc(syevr)), liblapack), Void, (Ptr{BlasChar}, Ptr{BlasChar}, Ptr{BlasChar}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{$elty}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, @@ -2913,7 +2915,7 @@ for (syev, syevr, sygvd, elty) in liwork = -one(BlasInt) info = Array(BlasInt, 1) for i = 1:2 - ccall(($(string(sygvd)),liblapack), Void, + ccall(($(blasfunc(sygvd)), liblapack), Void, (Ptr{BlasInt}, Ptr{BlasChar}, Ptr{BlasChar}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{$elty}, Ptr{BlasInt}, Ptr{BlasInt}, @@ -2957,7 +2959,7 @@ for (syev, syevr, sygvd, elty, relty) in rwork = Array($relty, max(1, 3n-2)) info = Array(BlasInt, 1) for i in 1:2 - ccall(($(string(syev)),liblapack), Void, + ccall(($(blasfunc(syev)), liblapack), Void, (Ptr{BlasChar}, Ptr{BlasChar}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$relty}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$relty}, Ptr{BlasInt}), &jobz, &uplo, &n, A, &stride(A,2), W, work, &lwork, rwork, info) @@ -3010,7 +3012,7 @@ for (syev, syevr, sygvd, elty, relty) in liwork = blas_int(-1) info = Array(BlasInt, 1) for i in 1:2 - ccall(($(string(syevr)),liblapack), Void, + ccall(($(blasfunc(syevr)), liblapack), Void, (Ptr{BlasChar}, Ptr{BlasChar}, Ptr{BlasChar}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{$elty}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, @@ -3066,7 +3068,7 @@ for (syev, syevr, sygvd, elty, relty) in lrwork = -one(BlasInt) info = Array(BlasInt, 1) for i = 1:2 - ccall(($(string(sygvd)),liblapack), Void, + ccall(($(blasfunc(sygvd)), liblapack), Void, (Ptr{BlasInt}, Ptr{BlasChar}, Ptr{BlasChar}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$relty}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$relty}, @@ -3112,7 +3114,7 @@ for (bdsqr, relty, elty) in work = Array($elty, 4n) info = Array(BlasInt,1) - ccall(($(string(bdsqr)),liblapack), Void, + ccall(($(blasfunc(bdsqr)), liblapack), Void, (Ptr{BlasChar}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$elty}, Ptr{$elty}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}), @@ -3168,7 +3170,7 @@ for (bdsdc, elty) in work =Array($elty, lwork) iwork=Array(BlasInt, 8n) info =Array(BlasInt, 1) - ccall(($(string(bdsdc)),liblapack), Void, + ccall(($(blasfunc(bdsdc)), liblapack), Void, (Ptr{BlasChar}, Ptr{BlasChar}, Ptr{BlasInt}, Ptr{$elty}, Ptr{$elty}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{BlasInt}), @@ -3205,7 +3207,7 @@ for (gecon, elty) in work = Array($elty, 4n) iwork = Array(BlasInt, n) info = Array(BlasInt, 1) - ccall(($(string(gecon)),liblapack), Void, + ccall(($(blasfunc(gecon)), liblapack), Void, (Ptr{Uint8}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{$elty}, Ptr{$elty}, Ptr{BlasInt}, Ptr{BlasInt}), @@ -3239,7 +3241,7 @@ for (gecon, elty, relty) in work = Array($elty, 2n) rwork = Array($relty, 2n) info = Array(BlasInt, 1) - ccall(($(string(gecon)),liblapack), Void, + ccall(($(blasfunc(gecon)), liblapack), Void, (Ptr{BlasChar}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$relty}, Ptr{$relty}, Ptr{$elty}, Ptr{$relty}, Ptr{BlasInt}), @@ -3271,7 +3273,7 @@ for (gehrd, elty) in lwork = blas_int(-1) info = Array(BlasInt, 1) for i = 1:2 - ccall(($(string(gehrd)),liblapack), Void, + ccall(($(blasfunc(gehrd)), liblapack), Void, (Ptr{BlasInt}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{$elty}, Ptr{BlasInt}, Ptr{BlasInt}), @@ -3310,7 +3312,7 @@ for (orghr, elty) in lwork = blas_int(-1) info = Array(BlasInt, 1) for i = 1:2 - ccall(($(string(orghr)),liblapack), Void, + ccall(($(blasfunc(orghr)), liblapack), Void, (Ptr{BlasInt}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{$elty}, Ptr{BlasInt}, Ptr{BlasInt}), @@ -3352,7 +3354,7 @@ for (gees, gges, elty) in lwork = blas_int(-1) info = Array(BlasInt, 1) for i = 1:2 - ccall(($(string(gees)),liblapack), Void, + ccall(($(blasfunc(gees)), liblapack), Void, (Ptr{BlasChar}, Ptr{BlasChar}, Ptr{Void}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$elty}, Ptr{$elty}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, @@ -3394,7 +3396,7 @@ for (gees, gges, elty) in lwork = blas_int(-1) info = Array(BlasInt, 1) for i = 1:2 - ccall(($(string(gges)), liblapack), Void, + ccall(($(blasfunc(gges)), liblapack), Void, (Ptr{BlasChar}, Ptr{BlasChar}, Ptr{BlasChar}, Ptr{Void}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$elty}, Ptr{$elty}, @@ -3442,7 +3444,7 @@ for (gees, gges, elty, relty) in rwork = Array($relty, n) info = Array(BlasInt, 1) for i = 1:2 - ccall(($(string(gees)),liblapack), Void, + ccall(($(blasfunc(gees)), liblapack), Void, (Ptr{BlasChar}, Ptr{BlasChar}, Ptr{Void}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$elty}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, @@ -3485,7 +3487,7 @@ for (gees, gges, elty, relty) in rwork = Array($relty, 8n) info = Array(BlasInt, 1) for i = 1:2 - ccall(($(string(gges)), liblapack), Void, + ccall(($(blasfunc(gges)), liblapack), Void, (Ptr{BlasChar}, Ptr{BlasChar}, Ptr{BlasChar}, Ptr{Void}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$elty}, Ptr{$elty}, @@ -3525,7 +3527,7 @@ for (fn, elty, relty) in ((:dsfrk_, :Float64, :Float64), k, n = size(A) end lda = max(1, stride(A, 2)) - ccall(($(string(fn)), liblapack), Void, + ccall(($(blasfunc(fn)), liblapack), Void, (Ptr{BlasChar}, Ptr{BlasChar}, Ptr{BlasChar}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$relty}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$relty}, Ptr{$elty}), @@ -3546,7 +3548,7 @@ for (fn, elty) in ((:dpftrf_, :Float64), function pftrf!(transr::Char, uplo::Char, A::StridedVector{$elty}) n = int(div(sqrt(8length(A)), 2)) info = Array(BlasInt, 1) - ccall(($(string(fn)), liblapack), Void, + ccall(($(blasfunc(fn)), liblapack), Void, (Ptr{BlasChar}, Ptr{BlasChar}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}), &transr, &uplo, &n, A, @@ -3567,7 +3569,7 @@ for (fn, elty) in ((:dpftri_, :Float64), function pftri!(transr::Char, uplo::Char, A::StridedVector{$elty}) n = int(div(sqrt(8length(A)), 2)) info = Array(BlasInt, 1) - ccall(($(string(fn)), liblapack), Void, + ccall(($(blasfunc(fn)), liblapack), Void, (Ptr{BlasChar}, Ptr{BlasChar}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}), &transr, &uplo, &n, A, @@ -3592,7 +3594,7 @@ for (fn, elty) in ((:dpftrs_, :Float64), nhrs = size(B, 2) ldb = max(1, stride(B, 2)) info = Array(BlasInt, 1) - ccall(($(string(fn)), liblapack), Void, + ccall(($(blasfunc(fn)), liblapack), Void, (Ptr{BlasChar}, Ptr{BlasChar}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$elty}, Ptr{$elty}, Ptr{BlasInt}, Ptr{BlasInt}), &transr, &uplo, &n, &nhrs, @@ -3615,7 +3617,7 @@ for (fn, elty) in ((:dtfsm_, :Float64), m, n = size(B) if int(div(sqrt(8length(A)), 2)) != m throw(DimensionMismatch("")) end ldb = max(1, stride(B, 2)) - ccall(($(string(fn)), liblapack), Void, + ccall(($(blasfunc(fn)), liblapack), Void, (Ptr{BlasChar}, Ptr{BlasChar}, Ptr{BlasChar}, Ptr{BlasChar}, Ptr{BlasChar}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$elty}, Ptr{$elty}, Ptr{$elty}, Ptr{BlasInt}), @@ -3636,7 +3638,7 @@ for (fn, elty) in ((:dtftri_, :Float64), function tftri!(transr::Char, uplo::Char, diag::Char, A::StridedVector{$elty}) n = int(div(sqrt(8length(A)), 2)) info = Array(BlasInt, 1) - ccall(($(string(fn)), liblapack), Void, + ccall(($(blasfunc(fn)), liblapack), Void, (Ptr{BlasChar}, Ptr{BlasChar}, Ptr{BlasChar}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}), &transr, &uplo, &diag, &n, @@ -3658,7 +3660,7 @@ for (fn, elty) in ((:dtfttr_, :Float64), n = int(div(sqrt(8length(Arf)), 2)) info = Array(BlasInt, 1) A = similar(Arf, $elty, n, n) - ccall(($(string(fn)), liblapack), Void, + ccall(($(blasfunc(fn)), liblapack), Void, (Ptr{BlasChar}, Ptr{BlasChar}, Ptr{BlasInt}, Ptr{$elty}, Ptr{$elty}, Ptr{BlasInt}, Ptr{BlasInt}), &transr, &uplo, &n, Arf, @@ -3681,7 +3683,7 @@ for (fn, elty) in ((:dtrttf_, :Float64), lda = max(1, stride(A, 2)) info = Array(BlasInt, 1) Arf = similar(A, $elty, div(n*(n+1), 2)) - ccall(($(string(fn)), liblapack), Void, + ccall(($(blasfunc(fn)), liblapack), Void, (Ptr{BlasChar}, Ptr{BlasChar}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}), &transr, &uplo, &n, A, @@ -3710,7 +3712,7 @@ for (fn, elty, relty) in ((:dtrsyl_, :Float64, :Float64), scale = Array($relty, 1) info = Array(BlasInt, 1) - ccall(($(string(fn)), liblapack), Void, + ccall(($(blasfunc(fn)), liblapack), Void, (Ptr{BlasChar}, Ptr{BlasChar}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$relty}, Ptr{BlasInt}), diff --git a/base/util.jl b/base/util.jl index 421856b62dbf3..df11d7c6d33f8 100644 --- a/base/util.jl +++ b/base/util.jl @@ -119,8 +119,10 @@ function blas_vendor() end if blas_vendor() == :openblas64 + blasfunc(x) = string(x)*"64_" openblas_get_config() = strip(bytestring( ccall((:openblas_get_config64_, Base.libblas_name), Ptr{Uint8}, () ))) else + blasfunc(x) = string(x) openblas_get_config() = strip(bytestring( ccall((:openblas_get_config, Base.libblas_name), Ptr{Uint8}, () ))) end From d297ffb70afce4df9bc865a5664733627bb12e69 Mon Sep 17 00:00:00 2001 From: Tony Kelman Date: Tue, 21 Oct 2014 11:50:22 -0700 Subject: [PATCH 4/5] add osx-only objconv dependency for renaming symbols (backport of fef2954881dc2dac47853b3d72cce15cf69374ed) Conflicts: deps/Makefile Hopefully fix #8842, objconv dependency not right (backport of dbcd50328314d2f632f4927466952868f581751d) We needed to move the objconv rules to above the openblas rules Fixes #8842 (backport of 2579a649fe8a6d0ee8b7d925e343527a4c8b622b) Conflicts: deps/Makefile --- LICENSE.md | 1 + deps/Makefile | 40 +++++++++++++++++++++++++++++++++++++--- 2 files changed, 38 insertions(+), 3 deletions(-) diff --git a/LICENSE.md b/LICENSE.md index 067e94194431a..95ac27e181030 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -74,6 +74,7 @@ Julia builds the following libraries by default, but does not use them itself: Julia's build process uses the following external tools: - [PATCHELF](http://hydra.nixos.org/build/1524660/download/1/README) +- [OBJCONV](http://www.agner.org/optimize/#objconv) Julia bundles the following external programs and libraries on some platforms: diff --git a/deps/Makefile b/deps/Makefile index 9e90378ccc001..ce6e0dbd0f78b 100644 --- a/deps/Makefile +++ b/deps/Makefile @@ -19,7 +19,7 @@ CONFIGURE_COMMON += F77="$(FC)" CC="$(CC)" CXX="$(CXX)" MAKE_COMMON = DESTDIR="" prefix=$(build_prefix) bindir=$(build_bindir) libdir=$(build_libdir) libexecdir=$(build_libexecdir) datarootdir=$(build_datarootdir) includedir=$(build_includedir) sysconfdir=$(build_sysconfdir) #autoconf configure-driven scripts: llvm pcre arpack fftw unwind gmp mpfr patchelf uv -#custom Makefile rules: openlibm Rmath double-conversion dsfmt suitesparse-wrapper suitesparse lapack openblas utf8proc +#custom Makefile rules: openlibm Rmath double-conversion dsfmt suitesparse-wrapper suitesparse lapack openblas utf8proc objconv # prevent installing libs into usr/lib64 on opensuse unexport CONFIG_SITE @@ -77,6 +77,11 @@ endif ifeq ($(USE_SYSTEM_BLAS), 0) STAGE1_DEPS += openblas +ifeq ($(USE_BLAS64), 1) +ifeq ($(OS), Darwin) +STAGE1_DEPS += objconv +endif +endif endif ifeq ($(USE_SYSTEM_FFTW), 0) @@ -144,7 +149,7 @@ install: $(addprefix install-, $(DEP_LIBS)) cleanall: $(addprefix clean-, $(DEP_LIBS)) distcleanall: $(addprefix distclean-, $(DEP_LIBS)) rm -rf $(build_prefix) -getall: get-llvm get-uv get-pcre get-double-conversion get-openlibm get-openspecfun get-dsfmt get-Rmath get-openblas get-lapack get-fftw get-suitesparse get-arpack get-unwind get-osxunwind get-gmp get-mpfr get-zlib get-patchelf get-utf8proc +getall: get-llvm get-uv get-pcre get-double-conversion get-openlibm get-openspecfun get-dsfmt get-Rmath get-openblas get-lapack get-fftw get-suitesparse get-arpack get-unwind get-osxunwind get-gmp get-mpfr get-zlib get-patchelf get-utf8proc get-objconv ## PATHS ## # sort is used to remove potential duplicates @@ -750,6 +755,34 @@ check-Rmath: compile-Rmath install-Rmath: $(RMATH_OBJ_TARGET) +## objconv ## + +OBJCONV_SOURCE = objconv/objconv +OBJCONV_TARGET = $(build_bindir)/objconv + +objconv.zip: + $(JLDOWNLOAD) $@ http://www.agner.org/optimize/objconv.zip +objconv/config.status: objconv.zip + unzip -d objconv $< + cd objconv && unzip source.zip + echo 1 > $@ +$(OBJCONV_SOURCE): objconv/config.status + cd objconv && $(CXX) -o objconv -O2 *.cpp +$(OBJCONV_TARGET): $(OBJCONV_SOURCE) | $(build_bindir) + cp -f $< $@ + +clean-objconv: + -rm -f $(OBJCONV_TARGET) +distclean-objconv: + -rm -rf objconv.zip objconv + +get-objconv: objconv.zip +configure-objconv: objconv/config.status +compile-objconv: $(OBJCONV_SOURCE) +check-objconv: compile-objconv +install-objconv: $(OBJCONV_TARGET) + + ## OpenBLAS ## # LAPACK is built into OpenBLAS by default @@ -792,8 +825,9 @@ endif # 64-bit BLAS interface ifeq ($(USE_BLAS64), 1) OPENBLAS_BUILD_OPTS += INTERFACE64=1 SYMBOLSUFFIX="64_" -ifeq ($(OS),Darwin) +ifeq ($(OS), Darwin) OPENBLAS_BUILD_OPTS += OBJCONV=$(JULIAHOME)/deps/objconv/objconv +$(OPENBLAS_OBJ_SOURCE): $(OBJCONV_SOURCE) endif endif From 8243c5b816dd79ff740255edd6af2c9e9cb011ef Mon Sep 17 00:00:00 2001 From: Tony Kelman Date: Wed, 22 Oct 2014 08:26:33 -0700 Subject: [PATCH 5/5] add .tar.xz and .zip files to source-dist (backport of 774f3c93f0cec1eaeebce63a8d45808a55e496df) --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 7d6de4ccc93d1..d05d926da27cc 100644 --- a/Makefile +++ b/Makefile @@ -360,7 +360,7 @@ source-dist: git-submodules # Create file source-dist.tmp to hold all the filenames that go into the tarball echo "base/version_git.jl" > source-dist.tmp git ls-files >> source-dist.tmp - ls deps/*.tar.gz deps/*.tar.bz2 deps/*.tgz >> source-dist.tmp + ls deps/*.tar.gz deps/*.tar.bz2 deps/*.tar.xz deps/*.tgz deps/*.zip >> source-dist.tmp git submodule --quiet foreach 'git ls-files | sed "s&^&$$path/&"' >> source-dist.tmp # Remove unwanted files