sfilippone / psblas3

A library of parallel sparse linear algebra on high performance computer.
Other
56 stars 12 forks source link

Add CMake functionality #12

Open zbeekman opened 4 years ago

zbeekman commented 4 years ago

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 commented 4 years ago

The conflicts in base/modules/aux are due, in part, to the fact that you cannot checkout a git branch/working copy on windows if there is a directory named aux so we renamed it to auxil. I can try to resolve some of these conflicts later tonight when I'm home.

zbeekman commented 4 years ago

@sfilippone I think it's just as much work to merge into develop and probably makes more sense for that to be the target. Please let me know if you disagree.