Hi, I’m trying to compile a solver library ForSolver using nvfortran. Unfortunately, nvfortran was unable to compile it. Below are the compiler outputs:
output
NVFORTRAN-S-0446-Argument number 2 to newton_method_t0: rank mismatch (././src/forsolver.f90: 245)
NVFORTRAN-S-0446-Argument number 3 to newton_method_t0: rank mismatch (././src/forsolver.f90: 245)
NVFORTRAN-S-0446-Argument number 2 to modified_newton_method_t0: rank mismatch (././src/forsolver.f90: 247)
NVFORTRAN-S-0446-Argument number 3 to modified_newton_method_t0: rank mismatch (././src/forsolver.f90: 247)
NVFORTRAN-S-0446-Argument number 2 to quasi_fd_newton_method_t0: rank mismatch (././src/forsolver.f90: 249)
NVFORTRAN-S-0446-Argument number 2 to modified_quasi_fd_newton_method_t0: rank mismatch (././src/forsolver.f90: 251)
0 inform, 0 warnings, 6 severes, 0 fatal for newton_rel_t0
NVFORTRAN-S-0043-Illegal attempt to redefine symbol fun (././src/forsolver.f90: 277)
NVFORTRAN-S-0037-Contradictory data type specified for fun (././src/forsolver.f90: 277)
NVFORTRAN-S-0043-Illegal attempt to redefine symbol dfun (././src/forsolver.f90: 283)
NVFORTRAN-S-0037-Contradictory data type specified for dfun (././src/forsolver.f90: 283)
NVFORTRAN-S-0074-Illegal number or type of arguments to newton_method_t1 - arguments of f and f do not agree (././src/forsolver.f90: 307)
NVFORTRAN-S-0074-Illegal number or type of arguments to newton_method_t1 - arguments of dfdx and dfdx do not agree (././src/forsolver.f90: 307)
NVFORTRAN-S-0074-Illegal number or type of arguments to modified_newton_method_t1 - arguments of f and f do not agree (././src/forsolver.f90: 309)
NVFORTRAN-S-0074-Illegal number or type of arguments to modified_newton_method_t1 - arguments of dfdx and dfdx do not agree (././src/forsolver.f90: 309)
NVFORTRAN-S-0074-Illegal number or type of arguments to quasi_fd_newton_method_t1 - arguments of f and f do not agree (././src/forsolver.f90: 311)
NVFORTRAN-S-0074-Illegal number or type of arguments to modified_quasi_fd_newton_method_t1 - arguments of f and f do not agree (././src/forsolver.f90: 313)
NVFORTRAN-S-0196-Deferred-shape specifiers are required for fun (././src/forsolver.f90)
NVFORTRAN-S-0196-Deferred-shape specifiers are required for dfun (././src/forsolver.f90)
0 inform, 0 warnings, 12 severes, 0 fatal for newton_rel_t1
NVFORTRAN-S-0446-Argument number 2 to quasi_cs_newton_method_t0: rank mismatch (././src/forsolver.f90: 362)
NVFORTRAN-S-0446-Argument number 2 to modified_quasi_cs_newton_method_t0: rank mismatch (././src/forsolver.f90: 364)
NVFORTRAN-S-0196-Deferred-shape specifiers are required for fun (././src/forsolver.f90)
0 inform, 0 warnings, 3 severes, 0 fatal for newton_complex_step_rel_t0
NVFORTRAN-S-0043-Illegal attempt to redefine symbol fun (././src/forsolver.f90: 385)
NVFORTRAN-S-0037-Contradictory data type specified for fun (././src/forsolver.f90: 385)
NVFORTRAN-S-0074-Illegal number or type of arguments to quasi_cs_newton_method_t1 - arguments of f and f do not agree (././src/forsolver.f90: 408)
NVFORTRAN-S-0074-Illegal number or type of arguments to modified_quasi_cs_newton_method_t1 - arguments of f and f do not agree (././src/forsolver.f90: 410)
NVFORTRAN-S-0196-Deferred-shape specifiers are required for fun (././src/forsolver.f90)
0 inform, 0 warnings, 5 severes, 0 fatal for newton_complex_step_rel_t1
NVFORTRAN-S-0095-Expression has wrong data type (././src/forsolver.f90: 557)
NVFORTRAN-S-0095-Expression has wrong data type (././src/forsolver.f90: 558)
NVFORTRAN-S-0196-Deferred-shape specifiers are required for fun (././src/forsolver.f90)
NVFORTRAN-S-0196-Deferred-shape specifiers are required for dfun (././src/forsolver.f90)
0 inform, 0 warnings, 4 severes, 0 fatal for newton_method_t0
NVFORTRAN-S-0095-Expression has wrong data type (././src/forsolver.f90: 618)
NVFORTRAN-S-0095-Expression has wrong data type (././src/forsolver.f90: 619)
NVFORTRAN-S-0196-Deferred-shape specifiers are required for fun (././src/forsolver.f90)
NVFORTRAN-S-0196-Deferred-shape specifiers are required for dfun (././src/forsolver.f90)
0 inform, 0 warnings, 4 severes, 0 fatal for modified_newton_method_t0
NVFORTRAN-S-0095-Expression has wrong data type (././src/forsolver.f90: 674)
NVFORTRAN-S-0155-Could not resolve generic procedure derivative (././src/forsolver.f90: 675)
NVFORTRAN-S-0196-Deferred-shape specifiers are required for fun (././src/forsolver.f90)
0 inform, 0 warnings, 3 severes, 0 fatal for quasi_fd_newton_method_t0
NVFORTRAN-S-0095-Expression has wrong data type (././src/forsolver.f90: 730)
NVFORTRAN-S-0155-Could not resolve generic procedure derivative (././src/forsolver.f90: 731)
NVFORTRAN-S-0196-Deferred-shape specifiers are required for fun (././src/forsolver.f90)
0 inform, 0 warnings, 3 severes, 0 fatal for modified_quasi_fd_newton_method_t0
NVFORTRAN-S-0043-Illegal attempt to redefine symbol fun (././src/forsolver.f90: 761)
NVFORTRAN-S-0037-Contradictory data type specified for fun (././src/forsolver.f90: 761)
NVFORTRAN-S-0043-Illegal attempt to redefine symbol dfun (././src/forsolver.f90: 767)
NVFORTRAN-S-0037-Contradictory data type specified for dfun (././src/forsolver.f90: 767)
NVFORTRAN-S-0196-Deferred-shape specifiers are required for fun (././src/forsolver.f90)
NVFORTRAN-S-0196-Deferred-shape specifiers are required for dfun (././src/forsolver.f90)
0 inform, 0 warnings, 6 severes, 0 fatal for newton_method_t1
NVFORTRAN-S-0043-Illegal attempt to redefine symbol fun (././src/forsolver.f90: 822)
NVFORTRAN-S-0037-Contradictory data type specified for fun (././src/forsolver.f90: 822)
NVFORTRAN-S-0196-Deferred-shape specifiers are required for fun (././src/forsolver.f90)
0 inform, 0 warnings, 3 severes, 0 fatal for modified_newton_method_t1
NVFORTRAN-S-0043-Illegal attempt to redefine symbol fun (././src/forsolver.f90: 883)
NVFORTRAN-S-0037-Contradictory data type specified for fun (././src/forsolver.f90: 883)
NVFORTRAN-S-0155-Could not resolve generic procedure derivative (././src/forsolver.f90: 907)
NVFORTRAN-S-0196-Deferred-shape specifiers are required for fun (././src/forsolver.f90)
0 inform, 0 warnings, 4 severes, 0 fatal for quasi_fd_newton_method_t1
NVFORTRAN-S-0043-Illegal attempt to redefine symbol fun (././src/forsolver.f90: 937)
NVFORTRAN-S-0037-Contradictory data type specified for fun (././src/forsolver.f90: 937)
NVFORTRAN-S-0155-Could not resolve generic procedure derivative (././src/forsolver.f90: 962)
NVFORTRAN-S-0196-Deferred-shape specifiers are required for fun (././src/forsolver.f90)
0 inform, 0 warnings, 4 severes, 0 fatal for modified_quasi_fd_newton_method_t1
NVFORTRAN-S-0152-All dimension specifiers must be ':' (././src/forsolver.f90: 1015)
nvfortran-Fatal-/prf/prg/lin/x86-x64/nvidia/hpc_sdk/Linux_x86_64/23.11/compilers/bin/tools/fort1 TERMINATED by signal 11
Arguments to /prf/prg/lin/x86-x64/nvidia/hpc_sdk/Linux_x86_64/23.11/compilers/bin/tools/fort1
/prf/prg/lin/x86-x64/nvidia/hpc_sdk/Linux_x86_64/23.11/compilers/bin/tools/fort1 ././src/forsolver.f90 -opt 1 -terse 1 -inform inform -nostatic -x 19 0x400000 -quad -x 59 4 -x 15 2 -x 49 0x400004 -x 51 0x20 -x 57 0x4c -x 58 0x10000 -x 124 0x1000 -tp haswell -x 57 0xfb0000 -x 58 0x78031040 -x 47 0x08 -x 48 4608 -x 49 0x100 -stdinc /prf/prg/lin/x86-x64/nvidia/hpc_sdk/Linux_x86_64/23.11/compilers/include:/prf/prg/lin/x86-x64/nvidia/hpc_sdk/Linux_x86_64/23.11/compilers/include-stdexec:/usr/lib/gcc/x86_64-linux-gnu/11/include:/usr/local/include:/usr/include/x86_64-linux-gnu:/usr/include -cmdline '+nvfortran ././src/forsolver.f90 -c -llapack -Minform=inform -Mbackslash -Mbounds -Mchkptr -Mchkstk -traceback -Mfree -module build/nvfortran_D7A6821995A683CD -Ibuild/nvfortran_D7A6821995A683CD -o build/nvfortran_D7A6821995A683CD/forsolver/src_forsolver.f90.o' -def __unix -def __unix__ -def unix -def linux -def __linux -def __linux__ -def __NO_MATH_INLINES -def __LP64__ -def __x86_64 -def __x86_64__ -def __LONG_MAX__=9223372036854775807L -def '__SIZE_TYPE__=unsigned long int' -def '__PTRDIFF_TYPE__=long int' -def __amd64 -def __amd64__ -def __k8 -def __k8__ -def __MMX__ -def __SSE_MATH__ -def __MMX_WITH_SSE__ -def __SSE__ -def __SSE2__ -def __SSE2_MATH__ -def __SSE3__ -def __SSSE3__ -def __SSE4_1__ -def __SSE4_2__ -def __ABM__ -def __ADX__ -def __AES__ -def __AVX__ -def __AVX2__ -def __BMI__ -def __BMI2__ -def __CLFLUSHOPT__ -def __CX16__ -def __F16C__ -def __FMA__ -def __FSGSBASE__ -def __FXSR__ -def __HLE__ -def __LZCNT__ -def __MOVBE__ -def __PCLMUL__ -def __POPCNT__ -def __PRFCHW__ -def __RDRND__ -def __RDSEED__ -def __RTM__ -def __LAHF_SAHF__ -def __SGX__ -def __XSAVE__ -def __XSAVEC__ -def __XSAVEOPT__ -def __XSAVES__ -idir build/nvfortran_D7A6821995A683CD -def __PGLLVM__ -def __NVCOMPILER_LLVM__ -def __extension__= -freeform -vect 48 -x 54 1 -x 68 0x1 -x 70 0x40000000 -x 70 0x40000000 -x 68 0x1 -x 124 1 -x 195 0x8000 -y 163 0xc0000000 -x 189 0x10 -x 124 0x40 -x 70 2 -x 70 4 -freeform -moddir build/nvfortran_D7A6821995A683CD -stbfile /tmp/nvfortranITuJnMT4wilgC.stb -modexport /tmp/nvfortranYTuJnwA_MEmxy.cmod -modindex /tmp/nvfortrancTuJngTX-je5s.cmdx -cci /tmp/nvfortransTuJn22PaCNrT.cci -output /tmp/nvfortrancTuJnggHBHrp2.ilm
To illustrate the issue, I’ve simplified it in an example below:
example_code1
module my_module
implicit none
type :: my_type
contains
procedure :: my_subroutine1
procedure :: my_subroutine2
end type my_type
contains
subroutine my_subroutine1(this, F, dFdx, x_sol)
interface
function Fun(x)
real, intent(in) :: x
real :: Fun
end function Fun
function dFun(x)
real, intent(in) :: x
real :: dFun
end function dFun
end interface
procedure(Fun) :: F
procedure(dFun), optional :: dFdx
class(my_type), intent(inout) :: this
real, intent(out) :: x_sol
call sub1_method1(this, F, dFdx, x_sol)
end subroutine my_subroutine1
subroutine my_subroutine2(this, F, x_sol)
interface
function Fun(x)
complex, intent(in) :: x
complex :: Fun
end function Fun
end interface
procedure(Fun) :: F
class(my_type), intent(inout) :: this
complex, intent(out) :: x_sol
call sub2_method1(this, F, x_sol)
end subroutine my_subroutine2
subroutine sub1_method1(this, F, dFdx, x_sol)
interface
function Fun(x)
real, intent(in) :: x
real :: Fun
end function Fun
function dFun(x)
real, intent(in) :: x
real :: dFun
end function dFun
end interface
procedure(Fun) :: F
procedure(dFun) :: dFdx
class(my_type), intent(inout) :: this
real, intent(out) :: x_sol
x_sol = 0.0
end subroutine sub1_method1
subroutine sub2_method1(this, F, x_sol)
interface
function Fun(x)
complex, intent(in) :: x
complex :: Fun
end function Fun
end interface
procedure(Fun) :: F
class(my_type), intent(inout) :: this
complex, intent(out) :: x_sol
x_sol = 0.0
end subroutine sub2_method1
end module my_module
program main
use my_module
implicit none
end program main
When compiling this code with nvfortran 23.7 and 23.11, I encounter the following error:
NVFORTRAN-S-0188-Argument number 2 to sub1_method1: type mismatch (test.f90: 31)
.
The provided code encounters an issue related to the naming of functions Fun
within the my_subroutine1
and my_subroutine2
. Changing Fun
in my_subroutine1
to Fun1
and Fun
in my_subroutine2
to Fun2
resolves the compilation error, see example_code2
. I think this could be a bug in compiler.
example_code2
module my_module
implicit none
type :: my_type
contains
procedure :: my_subroutine1
procedure :: my_subroutine2
end type my_type
contains
subroutine my_subroutine1(this, F, dFdx, x_sol)
interface
function Fun1(x)
real, intent(in) :: x
real :: Fun1
end function Fun1
function dFun(x)
real, intent(in) :: x
real :: dFun
end function dFun
end interface
procedure(Fun1) :: F
procedure(dFun), optional :: dFdx
class(my_type), intent(inout) :: this
real, intent(out) :: x_sol
call sub1_method1(this, F, dFdx, x_sol)
end subroutine my_subroutine1
subroutine my_subroutine2(this, F, x_sol)
interface
function Fun2(x)
complex, intent(in) :: x
complex :: Fun2
end function Fun2
end interface
procedure(Fun2) :: F
class(my_type), intent(inout) :: this
complex, intent(out) :: x_sol
call sub2_method1(this, F, x_sol)
end subroutine my_subroutine2
subroutine sub1_method1(this, F, dFdx, x_sol)
interface
function Fun(x)
real, intent(in) :: x
real :: Fun
end function Fun
function dFun(x)
real, intent(in) :: x
real :: dFun
end function dFun
end interface
procedure(Fun) :: F
procedure(dFun) :: dFdx
class(my_type), intent(inout) :: this
real, intent(out) :: x_sol
x_sol = 0.0
end subroutine sub1_method1
subroutine sub2_method1(this, F, x_sol)
interface
function Fun(x)
complex, intent(in) :: x
complex :: Fun
end function Fun
end interface
procedure(Fun) :: F
class(my_type), intent(inout) :: this
complex, intent(out) :: x_sol
x_sol = 0.0
end subroutine sub2_method1
end module my_module
program main
use my_module
implicit none
end program main
However, renaming Fun
and dFun
in the library doesn’t resolve all problems.
ifx, ifort, and gfortran can compile the original code without encountering any issues.
Thanks
Ali