Executive summary:

I believe revision 86265 makes it more difficult to build R with
OpenBLAS on Windows as now the entire LAPACK needs to be built to
obtain zspmv. Is there anything that can be done to allow the former
behavior to be used, something in Mkrules.local perhaps?

Detailed Explanation:

I have been building R with OpenBLAS for Windows 64 for over a decade
by patching /src/extra/blas/Makevars.win as follows:

--- /c/r/trunk/src/extra/blas/Makefile.win    2024-01-24
18:34:42.755255900 +0000
+++ /c/r/Makefile.win    2024-01-24 18:39:39.716458000 +0000
@@ -12,7 +12,7 @@
 ../../../$(BINDIR)/Rblas.dll: blas00.o ../../gnuwin32/dllversion.o
     @$(ECHO) -------- Building $@ --------
     $(DLL) -s -shared $(DLLFLAGS) -o $@ $^ Rblas.def \
-       -L../../../$(IMPDIR) -lR  -L"$(ATLAS_PATH)" -lf77blas -latlas
+       -L../../../$(IMPDIR) -lR -L"$(ATLAS_PATH)" -fopenmp -lopenblas
 else
 ../../../$(BINDIR)/Rblas.dll: blas.o blas2.o cmplxblas.o cmplxblas2.o
../../gnuwin32/dllversion.o
     @$(ECHO) -------- Building $@ --------

and then passing USE_ATLAS = YES and ATLAS_PATH = C:/R/OPB/whatever in
Mkrules.local

When I compile OpenBLAS, I have always done so with NO_CBLAS,
NO_LAPACK, and NO_SHARED, as the Windows toolchain does not need
CBLAS, a shared library, or allow for a separate LAPACK and this has
worked, for the most part, since roughly 2013.
When building the recent R-devel (a revision slightly before 86534),
the compilation stopped when building Rblas with the following error:

-------- Building ../../../bin/x64/Rblas.dll --------
gcc  -s -shared  -o ../../../bin/x64/Rblas.dll blas00.o
../../gnuwin32/dllversion.o Rblas.def \
   -L../../../bin/x64 -lR -L"C:/R/OPB/OpenBLAS-develop-f0560f9"
-fopenmp -lopenblas
C:\rtools44\x86_64-w64-mingw32.static.posix\bin/ld.exe: cannot export
zspmv_: symbol not defined
collect2.exe: error: ld returned 1 exit status
make[4]: *** [Makefile.win:14: ../../../bin/x64/Rblas.dll] Error 1
make[3]: *** [Makefile:227: Rblas] Error 2
make[2]: *** [Makefile:116: rbuild] Error 2
make[1]: *** [Makefile:17: all] Error 2
make: *** [Makefile:392: distribution] Error 2

I reached out to OpenBLAS (there were other issues with OPB 0.3.27)
and one of the maintainers responded:

> "for historical reasons, ZSPMV is in LAPACK although conceptionally [sic] it 
> belongs in BLAS. As you specified NO_LAPACK=1, this function gets omitted 
> since 0.3.20 to allow combining the BLAS-only build with an external LAPACK." 
> [1]

He later followed up with "0.3.26 built with NO_LAPACK=1 will likewise
omit the zspmv symbol (as directed)." [2]

I last successfully compiled v86152 with OpenBLAS 0.3.26 on
2024-03-19. When I compiled 86534 tonight with OPB 0.3.27, I got the
error above. I then tried with OPB 0.3.26—which worked for 86152—and
still got the zspmv error.

I am guessing this relates to revision 86265 "amending r85873: zspmv
is BLAS, not Lapack…" [3].

I built OpenBLAS AND its LAPACK, which takes MUCH MUCH longer, and
tried building R. This time, the build succeeded and passes make
check-devel.

Is there any way to allow the former functionality if the build
recognizes the use of OpenBLAS? Is the only option to compile
OpenBLAS's LAPACK too?

Thank you,

Avi


[1] https://github.com/OpenMathLib/OpenBLAS/issues/4684#issuecomment-2101123154
[2] https://github.com/OpenMathLib/OpenBLAS/issues/4684#issuecomment-2101213474
[3] 
https://github.com/r-devel/r-svn/commit/c9f3aba39aa89821d294f4a524331a21e6904aec

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to