Guidance on building FORTRAN wrappers
Guidance on building FORTRAN wrappers
I am wishing to run some routines such as magma_zcgesv from FORTRAN. There are wrappers for quite a lot of routines but not for this one.
I can see that the control subdirectory contains the files magma_zfortran.F90 and magma_zf77.cpp and it looks as though I can use some of the code there as a model to build my own wrappers. The macro FORTRAN_NAME is defined in include/magma_mangling.h
Are there any notes to follow to make a wrapper?
I may also want to build a modified version of magma_zcgesv and build a wrapper for that, compiling it outside magma. Would that be any different?
Thanks
John
I can see that the control subdirectory contains the files magma_zfortran.F90 and magma_zf77.cpp and it looks as though I can use some of the code there as a model to build my own wrappers. The macro FORTRAN_NAME is defined in include/magma_mangling.h
Are there any notes to follow to make a wrapper?
I may also want to build a modified version of magma_zcgesv and build a wrapper for that, compiling it outside magma. Would that be any different?
Thanks
John
Re: Guidance on building FORTRAN wrappers
The attached may help. I just did these real quick with a script that we use, but they do at least compile. Let us know if you have any problems with them.
-mark
-mark
- Attachments
-
- mixed_wrappers.tar.gz
- (1.49 KiB) Downloaded 138 times
Re: Guidance on building FORTRAN wrappers
Mark
Thank you for the quick response. I have had a look at these files. Presumably I just compile and link these files into my code.
John
P.S. I am currently using Magma 1.6.2
Thank you for the quick response. I have had a look at these files. Presumably I just compile and link these files into my code.
John
P.S. I am currently using Magma 1.6.2
Re: Guidance on building FORTRAN wrappers
Yes. They mirror existing files in the control directory, adding Fortran wrappers for the mixed precision routines. We base the Fortran wrappers off the header files (e.g., include/magma_z.h), and the mixed routines have their own header files (e.g., include/magma_zc.h), which is why they weren't included before.
I don't think we've changed any of these routines since 1.6.2, so they should still work there.
-mark
I don't think we've changed any of these routines since 1.6.2, so they should still work there.
-mark
Re: Guidance on building FORTRAN wrappers
Mark
Thank you for this. I will give these a try out.
John
Thank you for this. I will give these a try out.
John
Re: Guidance on building FORTRAN wrappers
I have built the attached Fortran program testing_zcgesv_gpu_f by extending the Fortran one for zgetrf_gpu with material suggested by the C++ one for zcgesv_gpu.
This routine does a similar calculation to the one in the Fortran one for zgetrf_gpu with magma_zcgesv_gpu as well and prints both sets of answers.
The output is like this:
I hope this is useful
John
P.S. As this is my 200th message, I want to thank the MAGMA team for all your help over the years I have been in contact with you. Best wishes.
This routine does a similar calculation to the one in the Fortran one for zgetrf_gpu with magma_zcgesv_gpu as well and prints both sets of answers.
The output is like this:
Code: Select all
size_of_int = 4
ZCGESV iters : 3
Solving A x = b using mixed precision factorization:
|| A || = 1.063E+03
|| b || = 9.994E-01
|| x || = 1.908E+00
|| b - A x || = 3.642E-14
Gflops = 38.019799967504056
Solution is CORRECT
Solving A x = b using LU factorization:
|| A || = 1.063E+03
|| b || = 9.994E-01
|| x || = 1.908E+00
|| b - A x || = 9.535E-13
Gflops = 13.994576034374978
Solution is CORRECT
John
P.S. As this is my 200th message, I want to thank the MAGMA team for all your help over the years I have been in contact with you. Best wishes.
- Attachments
-
- testing_zcgesv_gpu_f.F90.txt
- Test file for zcgesv_gpu from Fortran. I added the extension .txt as the system does not allow F90 as an extension!
- (7.07 KiB) Downloaded 126 times