Problem of xlf+xlc for magma has been resolved.

Open discussion for MAGMA library (Matrix Algebra on GPU and Multicore Architectures)
Post Reply
huangguiyang
Posts: 6
Joined: Mon Sep 16, 2019 5:59 pm

Problem of xlf+xlc for magma has been resolved.

Post by huangguiyang » Thu Sep 26, 2019 1:51 pm

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.

Fyffe
Posts: 1
Joined: Thu Sep 26, 2019 7:14 am

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

Post by Fyffe » Fri Sep 27, 2019 9:11 am

How exactly do you add the underscore manually? I feel like I'm missing something very obvious.

mgates3
Posts: 915
Joined: Fri Jan 06, 2012 2:13 pm

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

Post by mgates3 » Fri Sep 27, 2019 2:09 pm

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

huangguiyang
Posts: 6
Joined: Mon Sep 16, 2019 5:59 pm

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

Post by huangguiyang » Thu Oct 17, 2019 12:21 pm

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.

Post Reply