Skip to content

Fix real norm workspace arguments in CGECXX and ZGECXX - #1447

Merged
langou merged 1 commit into
Reference-LAPACK:masterfrom
nakatamaho:fix/gecxx-workspace-types
Oct 25, 2026
Merged

langou merged 1 commit into
Reference-LAPACK:masterfrom
nakatamaho:fix/gecxx-workspace-types

Conversation

@nakatamaho

Copy link
Copy Markdown
Contributor

CLANGE and ZLANGE require real WORK arrays; pass RWORK rather than the complex WORK array when computing FNRMK. Their Frobenius-norm paths do not reference the workspace, so this corrects the Fortran interface without changing the numerical algorithm.

Checked all four precisions: the real callers already have the correct types. Same-unit caller/callee compilation rejects C/Z before the patch and accepts all four after it. Native query and numerical smoke checks passed 96 cases per version (before and after).

Description

Checklist

  • The documentation has been updated.
  • If the PR solves a specific issue, it is set to be closed on merge.

CLANGE and ZLANGE require real WORK arrays; pass RWORK rather than the complex WORK array when computing FNRMK. Their Frobenius-norm paths do not reference the workspace, so this corrects the Fortran interface without changing the numerical algorithm.

Checked all four precisions: the real callers already have the correct types. Same-unit caller/callee compilation rejects C/Z before the patch and accepts all four after it. Native query and numerical smoke checks passed 96 cases per version (before and after).
@codecov

codecov Bot commented Oct 25, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 69.72%. Comparing base (c9713d3) to head (8ebf4c8).
✅ All tests successful. No failed tests found.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1447   +/-   ##
=======================================
  Coverage   69.72%   69.72%           
=======================================
  Files        6204     6204           
  Lines      497194   497194           
  Branches    23430    23430           
=======================================
  Hits       346652   346652           
  Misses     150116   150116           
  Partials      426      426           
Components Coverage Δ
BLAS 99.76% <ø> (ø)
CBLAS 96.98% <ø> (ø)
LAPACK 82.66% <100.00%> (ø)
LAPACKE 2.15% <ø> (ø)
TMGLIB 55.69% <ø> (ø)
BLAS testing 88.77% <ø> (ø)
CBLAS testing 89.63% <ø> (ø)
LAPACK testing 82.25% <ø> (ø)
LAPACKE testing ∅ <ø> (∅)
Files with missing lines Coverage Δ
SRC/cgecxx.f 74.32% <100.00%> (ø)
SRC/zgecxx.f 74.32% <100.00%> (ø)

Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c9713d3...8ebf4c8. Read the comment docs.

@langou langou left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. Good catch!

Note that the run "openmp-windows-2025-gfortran (static)" initially failed so I had to wait for all test to complete, and once all tests completed I had to click on "re-rerun failed test" and it then worked. This is the second time I have had to do this. Last time was with @jprhyne. I am letting everyone know in case this also happens to you and you need me to click on "rereun failed jobs". This is not great to have to do this, but it is what it is. I do not know what the job fails the first time. I think it times out or something like that.

Thanks @nakatamaho !

@langou
langou merged commit 6a1a8b8 into Reference-LAPACK:master Oct 25, 2026
62 of 63 checks passed
@nakatamaho

Copy link
Copy Markdown
Contributor Author

Appreciated it, as always, langou-san!!

@ilayn

ilayn commented Oct 25, 2026

Copy link
Copy Markdown
Contributor

I do not know what the job fails the first time. I think it times out or something like that.

Often that happens when the CI runner runs on different hardware AMD vs Intel based machines cause that kind of sporadic failures.

@mohawk2

mohawk2 commented Oct 26, 2026

Copy link
Copy Markdown
Contributor

Thanks. Good catch!

Note that the run "openmp-windows-2025-gfortran (static)" initially failed so I had to wait for all test to complete, and once all tests completed I had to click on "re-rerun failed test" and it then worked. This is the second time I have had to do this. Last time was with @jprhyne. I am letting everyone know in case this also happens to you and you need me to click on "rereun failed jobs". This is not great to have to do this, but it is what it is. I do not know what the job fails the first time. I think it times out or something like that.

@langou This is the failure, visible at https://github.com/Reference-LAPACK/lapack/actions/runs/40141522547/job/121014081637?pr=1447 line 489 et seq, it's not a timeout:

239/299 Test #207: LAPACK-xeigtstz_64_se2_in ..............***Failed    2.28 sec
Running: D:/a/lapack/lapack/build/bin/xeigtstz_64.exe
ARGS= OUTPUT_FILE;D:/a/lapack/lapack/build/TESTING/zse2_64.out;ERROR_FILE;D:/a/lapack/lapack/build/TESTING/zse2_64.out.err;INPUT_FILE;D:/a/lapack/lapack/TESTING/se2.in
Test OUTPUT:
 Tests of the Hermitian Eigenvalue Problem routines

 LAPACK VERSION 3.12.1

 The following parameter values will be used:
    M:         0     1     2     3     5    20
    N:         0     1     2     3     5    20
    NB:        1     3     3     3    10
    NBMIN:     2     2     2     2     2
    NX:        1     0     5     9     1

 Relative machine underflow is taken to be    0.222507-307
 Relative machine overflow  is taken to be    0.179769+309
 Relative machine precision is taken to be    0.111022D-15

 Routines pass computational tests if test ratio is less than   60.00

 ZST routines passed the tests of the error exits (179 tests done)

 SE2:  NB =   1, NBMIN =   2, NX =   1

 All tests for ZST passed the threshold (  4440 tests run)

 All tests for ZST drivers  passed the threshold (  11016 tests run)

 SE2:  NB =   3, NBMIN =   2, NX =   0

 All tests for ZST passed the threshold (  4440 tests run)

 All tests for ZST drivers  passed the threshold (  11016 tests run)

 SE2:  NB =   3, NBMIN =   2, NX =   5

 All tests for ZST passed the threshold (  4440 tests run)

Test ERROR:

Program received signal SIGSEGV: Segmentation fault - invalid memory reference.

Backtrace for this error:
#0  0x3823d873
#1  0x381ab403
#2  0xb62e4f21
#3  0x51e8158e
#4  0x547269fe
#5  0x545d2a36
#6  0x5472633d
#7  0x51ddd3e2
#8  0x51dde37c
#9  0x51dde00f
#10  0x51dddfaa
#11  0x51dddd06
#12  0x38256053
#13  0x3824277f
#14  0xb6123cff
#15  0xb60721df
#16  0xb6044a06
#17  0xb62e630f
#18  0xb60410c6
#19  0xb6041405
#20  0x53a5dd36
#21  0x545ff2bb
#22  0xffffffff

CMake Error at D:/a/lapack/lapack/TESTING/runtest.cmake:36 (message):
  Test D:/a/lapack/lapack/build/bin/xeigtstz_64.exe returned 3

@mohawk2

mohawk2 commented Oct 26, 2026

Copy link
Copy Markdown
Contributor

Immediate speculation about why it's failing on OpenMP, with Windows, and intermittently: it could be similar to the problem I addressed in 43d0daa as part of #1407, with workspace calculation being suddenly much larger due to new threads being spawned. If that's so, then the calculation might be going outside its allotted work area in some threads, causing a SEGV.

Someone more knowledgeable than me can figure from the log above which routine is having this problem, which will narrow it down.

@mohawk2

mohawk2 commented Oct 26, 2026

Copy link
Copy Markdown
Contributor

A technique I figured out a few years ago to make Fortran77 types be consistent between caller and callee is noted in PDLPorters/pdl#369 (comment), as part of getting some bundled F77 code (in fact part of LINPACK) to be 64-bit integers. I reproduce it here:

I did some extra checks for Slatec, using these techniques; first I replaced all the individual files in Libtmp/Slatec/Makefile with:

FFLAGS=-fPIC -std=legacy -cpp

slatec/bigun$(OBJ_EXT): slatec/bigun.f
        gfortran -c  $(FFLAGS)  -o slatec/bigun$(OBJ_EXT)   slatec/bigun.f

Then iterated to find further problems and fix them using:

(cd Libtmp/Slatec/;
  (for x in slatec/[c-z]*.f; do echo "#line 1 \"$x\""; cat $x; done) >bigun.f; mv bigun.f slatec/;
  time make test
) |&less

which lets the compiler see all the Fortran at once and so detect problems, while with the -cpp and #line directives still show the right file and line numbers. Interestingly, because there are 112 files there, it takes something like 2s to compile them individually, but only about 1.1s to compile the concatenated file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants