Page 1 of 1

Problem of xlf+xlc for magma has been resolved.

Posted: Thu Sep 26, 2019 1:51 pm
by huangguiyang
xlf does not add underscore to the function name.
If the code which is using magma included an interface for magma, it may still use the name convection with underscores. When gnu or pgi compiler is used, it is ok. But for xl compiler, it would have errors.

The solution is adding underscores to the function name to the main program manually for the xlf Fortran compiler.


When magma is compiled using -DADD_, it still tries to link the function name without underscores. Using "-qextname" to recompile lapack, and the main program can not resolve the problem.

Re: Problem of xlf+xlc for magma has been resolved.

Posted: Fri Sep 27, 2019 9:11 am
by Fyffe
How exactly do you add the underscore manually? I feel like I'm missing something very obvious.

Re: Problem of xlf+xlc for magma has been resolved.

Posted: Fri Sep 27, 2019 2:09 pm
by mgates3
When using xlf, use -DNOCHANGE instead of -DADD_ in the make.inc file when compiling MAGMA. Then it will use the correct Fortran naming convention for IBM's Fortran.

Ideally, the whole software stack — e.g., BLAS, LAPACK, MAGMA, your application — are compiled using the same set of compilers (e.g., xlf and xlc, or gfortran and g++) so the same conventions are used throughout.

-mark

Re: Problem of xlf+xlc for magma has been resolved.

Posted: Thu Oct 17, 2019 12:21 pm
by huangguiyang
magma is a c or c++ code program.

If a Fortran code want to use the magma, a fortran-c interface is necessary.
However, it is possible that the included fortran-c interface has a trailing underscore.

For pgi or gnu compiler, it will add an underscore to the Fortran function name automatically. Then the Fortran code can call the correct interface function, not call directly the magma function.

For xl compiler, it does not add an underscore to function name automatically. The Fortran code would link the function of magma directly, but not the interface function, because the interface function has a different name due to the trailing underscore.

In order to resolve this problem, I revised the Fortran code, and add an underscore to the function name (corresponding to magma function), because the fortran-c interface has an underscore for the function name.

There is no warning message. It may be not easy to find out it has linked to the wrong function for xl compiler.

Even if all codes are compiled using xlf and xlc, there are still problems.