psblas3 icon indicating copy to clipboard operation
psblas3 copied to clipboard

Add CMake functionality

Open zbeekman opened this issue 4 years ago • 2 comments

Hi Salvatore and Fabio,

Here is a pull request to upstream the CMake build system that I/we added. The initial cut at this was somewhat sloppy, but the end product is not so bad.

There are some things that can stand to be updated/changed, but it has worked for us on Linux and macOS with GCC/GFortran 8, Windows with MSVC C compiler and Intel Fortran 2018 compiler, and Linux with Intel 18 for Fortran & C.

There were some concerns about the license of ParMetis which is NOT free to use, and is not a normal, OSI approved license, so the build system finds and links with Metis, NOT ParMetis. To get Metis to build on windows and all platforms, I wrote a CMake build system for that as well:

https://github.com/nrc-fuels/metis

One focus/requirement of the project was to be able to make binaries as redistributable as possible, so I think things are setup to statically link by default.

Another issue we encountered was that GFortran was generating ABI incompatible code when using -fcoarray=lib to build and link code against OpenCoarrays. While PSBLAS does not use OpenCoarrays (as far as I know) we other parts of the project were using it, so we had to add a flag to allow all the libraries to be ABI compatible by building everything with -fcoarray=lib and linking to OpenCoarrays. This is an option in the CMake build, and should be OFF by default, if my memory is correct.

There are some utility functions and modules in the top level cmake directory.

IMO, most of the introspection stuff surrounding name mangling and other issues should be obviated (become unnecessary) through the use of ISO_C_BINDING. CMake provides some intrinsic support for name mangling introspection but it wasn't 100% compatible with the way PSBLAS was doing things, from what I recall.

zbeekman avatar Mar 09 '20 15:03 zbeekman