forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Adding LAPACK and BLAS

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Plato
View previous topic :: View next topic  
Author Message
achilles78



Joined: 27 May 2006
Posts: 3

PostPosted: Sat May 27, 2006 11:40 pm    Post subject: Adding LAPACK and BLAS Reply with quote

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
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7916
Location: Salford, UK

PostPosted: Tue May 30, 2006 12:20 am    Post subject: Adding LAPACK and BLAS Reply with quote

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.
Back to top
View user's profile Send private message AIM Address
achilles78



Joined: 27 May 2006
Posts: 3

PostPosted: Tue May 30, 2006 8:42 am    Post subject: Adding LAPACK and BLAS Reply with quote

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
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7916
Location: Salford, UK

PostPosted: Mon Jun 05, 2006 11:37 pm    Post subject: Adding LAPACK and BLAS Reply with quote

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).
Back to top
View user's profile Send private message AIM Address
achilles78



Joined: 27 May 2006
Posts: 3

PostPosted: Tue Jun 06, 2006 9:26 am    Post subject: Adding LAPACK and BLAS Reply with quote

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: ReleaseWin32LAPACK.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 ReleaseWin32LAPACK.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
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7916
Location: Salford, UK

PostPosted: Tue Jun 06, 2006 9:58 am    Post subject: Adding LAPACK and BLAS Reply with quote

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.
Back to top
View user's profile Send private message AIM Address
tk



Joined: 20 Jan 2007
Posts: 7
Location: Dublin, Ireland

PostPosted: Sat Jan 20, 2007 10:09 pm    Post subject: Did You Finally Get The LAPACK & BLAS Library Working ? Reply with quote

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
Back to top
View user's profile Send private message
mattieb



Joined: 02 Feb 2007
Posts: 1

PostPosted: Fri Aug 03, 2007 11:20 pm    Post subject: Reply with quote

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!
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Plato All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group