[Rd] Matrix issues when building R with znver3 architecture under GCC 11
Henrik Bengtsson
henr|k@bengt@@on @end|ng |rom gm@||@com
Tue Apr 12 15:13:26 CEST 2022
Shooting from the hip: What happens if you compile with -O2 instead of -O3?
Henrik
On Mon, Apr 11, 2022, 18:27 Kieran Short <kieran.short using gmail.com> wrote:
> Hello,
>
> I'm new to this list, and have subscribed particularly because I've come
> across an issue with building R from source with an AMD-based Zen
> architecture under GCC11. Please don't attack me for my linux operating
> system choice, but it is Ubuntu 20.04 with Linux Kernel 5.10.102.1 -
> microsoft-standard-WSL2. I've built GCC11 using GCC8 (the standard GCC
> under Ubuntu20.04 WSL release), under Windows11 with wslg. WSL2/g runs as a
> hypervisor with ports to all system resources including display, GPU (cuda,
> etc).
>
> The reason why I am posting this email is that I am trying to compile R
> using the AMD Zen3 platform architecture rather than x86/64, because it has
> processor-specific optimizations that improve performance over the standard
> x86/64 in benchmarks. The Zen3 architecture optimizations are not available
> in earlier versions of GCC (actually, they have possibly been backported to
> GCC10 now). Since Ubuntu 20.04 doesn't have GCC11, I compiled the GCC11
> compiler using the native GCC8.
>
> The GCC11 I have built can build R 4.1.3 with a standard x86-64
> architecture and pass all tests with "make check-all".
> I configured that with:
> > ~/R/R-4.1.3/configure CC=gcc-11.2 CXX=g++-11.2 FC=gfortran-11.2
> CXXFLAGS="-O3 -march=x86-64" CFLAGS="-O3 -march=x86-64" FFLAGS="-O3
> -march=x86-64" --enable-memory-profiling --enable-R-shlib
> and built with
> > make -j 32 -O
> > make check-all
> ## PASS.
>
> So I can build R in my environment with GCC11.
> In configure, I am using references to "gcc-11.2" "gfortran-11.2" and
> "g++-11.2" because I compiled GCC11 compilers with these suffixes.
>
> Now, I'm using a 32 thread (16 core) AMD Zen3 CPU (a 5950x), and want to
> use it to its full potential. Zen3 optimizations are available as a
> -march=znver3 option n GCC11. The znver3 optimizations improve performance
> in Phoronix Test Suite benchmarks (I'm not aware of anyone that has
> compiled R with them). See:
> https://www.phoronix.com/scan.php?page=article&item=amd-5950x-gcc11
>
> However, the R 4.1.3 build (made with "make -j 32 -O"), configured with
> -march=znver3, produces an R that fails "make check-all".
>
> > ~/R/R-4.1.3/configure CC=gcc-11.2 CXX=g++-11.2 FC=gfortran-11.2
> CXXFLAGS="-O2 -march=znver3" CFLAGS="-O2 -march=znver3" FFLAGS="-O2
> -march=znver3" --enable-memory-profiling --enable-R-shlib
> or
> > ~/R/R-4.1.3/configure CC=gcc-11.2 CXX=g++-11.2 FC=gfortran-11.2
> CXXFLAGS="-O3 -march=znver3" CFLAGS="-O3 -march=znver3" FFLAGS="-O3
> -march=znver3" --enable-memory-profiling --enable-R-shlib
>
> The fail is always in the factorizing.R Matrix.R tests, and in particular,
> there are a number of errors and a fatal error.
> I have attached the output because I cannot really understand what is going
> wrong. But results returned from matrix calculations are obviously odd with
> -march=znver3 in GCC 11. There is another backwards-compatible architecture
> option "znver2" and this has EXACTLY the same result.
>
> While there are other warrnings and errors (many in assert.EQ() ), the
> factorizing.R script continues. The fatal error (at line 2662 in the
> attached factorizing.Rout.fail text file) is:
>
> > ## problematic rank deficient rankMatrix() case -- only seen in large
> cases ??
> > Z. <- readRDS(system.file("external", "Z_NA_rnk.rds", package="Matrix"))
> > tools::assertWarning(rnkZ. <- rankMatrix(Z., method = "qr")) # gave
> errors
> Error in assertCondition(expr, classes, .exprString = d.expr) :
> Failed to get warning in evaluating rnkZ. <- rankMatrix(Z., method ...
> Calls: <Anonymous> -> assertCondition
> Execution halted
>
> Can anybody shed light on what might be going on here? 'make check-all'
> passes all the other checks. It is just factorizing.R in Matrix that fails
> (other matrix tests run ok).
> Sorry this is a bit long-winded, but I thought details might be important.
>
> best regards,
> Kieran
> ______________________________________________
> R-devel using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>
[[alternative HTML version deleted]]
More information about the R-devel
mailing list