Silverfrost Forums

Welcome to our forums

Adding LAPACK and BLAS

27 May 2006 10:40 #693

I would like to be able to call LAPACK and BLAS subroutines whenever I want. The two solutions I can see from the forums don't work:

  1. Using INCLUDE and placing LAPACK/BLAS subroutines in the directory doesn't work: LAPACK subroutines call other LAPACK subroutines without using INCLUDE.
  2. Creating a .dll file doesn't work because it takes too much time to add existing items in blocks of less than 30 when the LAPACK, BLAS library is so big.

There has to be a better way. Is there are prebuilt LAPACk/BLAS .dll. I have alredy downloaded all the .f files.

thank you

josh

29 May 2006 11:20 #701

Josh

  1. INCLUDE files are normally used when there is a change of protocol (STDCALL or C_EXTERNAL) and/or when some arguments require conversion. If you create an FTN95 DLL then neither of these apply. As I recall you will not need any Fortran 90/95 INTERFACEs for these routines (there are no OPTIONAL or KEYWORD arguements and no assumed shape arrays) so all you need to do is to make sure that the return type of each FUNCTION is declared when you use it.

  2. It should not take so long to compile the DLL. Even if it does, you only have to create the DLL once. Just put the whole library into one DLL.

If you manage to find an existing Win32 DLL, it will probably have been compiled using STDCALL. In which case you should use /IMPORT_LIB <dllname> when compiling.

30 May 2006 7:42 #705

thanks for replying so quickly! So I tried to follow 2) above. I opened a new FORTRAN DLL in Plato3 and started the following proccess, click 'Add existing items', change the file type to .f, highlight about 30 LAPACK files, and then open. The first batch of 30 caused only a 10 second hourglass icon. The second batch caused about 30 seconds. The third batch took over a minute and the fourth batch took over 2 minutes for the hourglass icon to switch back to an arrow. LAPACK has 1,292 subroutines in it's SRC directory... at this rate it will take days to add all the files to the dll, and it may not work in the end. LAPACK is a key resource for my academic work. Also, on a different note, I found that you shouldn't build a BLAS dll but find one that is optimised for your compiler/system-- does Salford have one?

-josh

5 Jun 2006 10:37 #714

Josh

From your description it looks like you need to switch off the file dependency checking (on the Project menu) before opening the files. You can leave it switched off because file dependency checking will not been particularly helpful in this context.

For an optimised DLL you should build in release mode. You can also add /OPT in the Project Properties to see if this improves the speed.

There is no problem about building your own BLAS DLL. We do not release one at the moment. If we did we would follow the same process that you are using (with the above recommendations).

6 Jun 2006 8:26 #715

Paul- I compiled the .dll file with no errors. I added it as a reference to a fortran project but using 'call subroutineabc(a,b,c)' didn't work . When I ran it nothing happened, even the statements that came before the call weren't carried out. When I tried to open the .exe in the project directory under CheckMate/Win32 I got the error 'The procedure entry point SUBROUTINEABC could not be located in the dynamic link library LAPACK.dll' Is there a step-by-step guide to building and referencing a .dll correctly? I think I did it right and you can check my steps and settings below

Here is what I did and what happend when creating the .dll: I opened a dll project in Plato3 and added all the LAPACK subroutines 50 at a time (you can't add more than that at once). I clicked build: every .f file compiled but there were many warnings. The final output statement was: Compiling file: cgesc2.f Compilation completed with no errors Linking... WARNING - Default LibMain being provided <here there were many .f and .obj associations listed> Creating dynamic link library: Release\Win32\LAPACK.dll

I had the following Settings:

  1. Release Win32.
  2. Under >Project>Properties>Configuration Properties>Compiler Options>Optimisation I had the Optimise code box checked
  3. Under >Project>Properties>Configuration Properties>Compiler Options>Miscellaneous I had Output filename checked with Release\Win32\LAPACK.dll showing. I also had Output filetype checked.
  4. Under >Project>Properties>Configuration Properties>Compiler Options>Switches I had /OPTIMISE showing
  5. Under >Project>Properties>Configuration Properties>Linker Options>Linker Options I had Export all box checked
  6. Under >Project>Properties>Configuration Properties>Linker Options>Switches I had -EXPORTALL showing.
  7. All other >Project boxes were unchecked including Enable dependency checking, Build uses active source only, and Set Target

thank you, josh

josh

6 Jun 2006 8:58 #716

Josh

This looks like the right process. All that I can suggest is that you do something very simple first... Create a simple program with an external routine and step through it with the debugger to make sure it is working. Next move the external routine into a DLL and create a reference to it. Again, do everything in DEBUG mode and step through as before. Then you will be able to expand to many external routines in a DLL. Use CHECKMATE whilst developing then switch it off when things are working correctly.

20 Jan 2007 9:09 #1554

Achilles,

I am curious as to how you got on with this.

I was casting round for a Salford version of these libraries - like Intel's MKL library - but got no response.

One cannot do too much without a basic library set like this.

Regards,

tk

3 Aug 2007 10:20 #2143

This may or may not be useful, but I've just spent a day trying to get LAPACK into a dll.

I'm using the compiler through MS Visual Studio. To get the LAPACK routines exposed from your DLL, you may have to add the /EXPORTALL directive to 'extra linker options' (or whatever the equivalent is).

I don't fully understand the DLL system, but I guess the 'The procedure entry point SUBROUTINEABC could not be located in the dynamic link library LAPACK.dll' is because you're not exporting a reference to it?

Anyway, it was only after adding this option that I could get mine to work.

There's probably some keyword that will allow you to export subroutines individually, but that would obviously take ages for something like BLAS/LAPACK!

Please login to reply.