scivision / mumps

MUMPS via CMake
http://mumps-solver.org
MIT License
115 stars 46 forks source link

How to set the mumps version #12

Closed eike-fokken closed 3 years ago

eike-fokken commented 3 years ago

Hi! I'm looking into building Ipopt with cmake. Therefore I need mumps and I came across this lovely project. First of all many thanks for putting in the work to build mumps with cmake!

For Ipopt I would like to build mumps 4.10.0 (it seems to be better for smaller instances, which I have). I saw in the CMakeLists.txt that there is a variable named

if(NOT MUMPS_UPSTREAM_VERSION)
  set(MUMPS_UPSTREAM_VERSION 5.4.1)
endif()

so I tried to run cmake with

cmake -G"Ninja" -B build -S .  -DMUMPS_UPSTREAM_VERSION=4.10.0   

but that yielded

CMake Error at cmake/get_mumps.cmake:6 (string):
  string sub-command JSON member 'mumps 4.10.0' not found.
Call Stack (most recent call first):
  CMakeLists.txt:46 (include)

CMake Error at cmake/get_mumps.cmake:7 (math):
  math cannot parse the expression: "mumps-4.10.0-NOTFOUND-1": syntax error,
  unexpected exp_NUMBER, expecting end of file (11).
Call Stack (most recent call first):
  CMakeLists.txt:46 (include)

CMake Error at cmake/get_mumps.cmake:8 (foreach):
  foreach Invalid integer: 'ERROR'
Call Stack (most recent call first):
  CMakeLists.txt:46 (include)

Could you give me a hint?

eike-fokken commented 3 years ago

Oh, does this project only work for mumps 5. ...? Following your github action I just tried to set the version to 5.3.5, which worked.

eike-fokken commented 3 years ago

Ok, now I see, only specific versions are supported. The sha256 are the checksums of the downloaded tar file, right?

Maybe I'll have a look, whether one could simply add the relevant entry for 4.10.0

Or do you not want that, because 4.10.0 is no longer supported?

scivision commented 3 years ago

OK thanks, I could also make it so that there are a few "known working" MUMPS versions where there is a SHA256 checksum, and then allow additional MUMPS versions where I don't have the SHA256 checksum and haven't checked that the particular MUMPS version works

scivision commented 3 years ago

The current "main" branch commit built for me starting with:

cmake -B build "-DMUMPS_UPSTREAM_VERSION=4.10.0"
cmake --build build

ctest --test-dir build

As I mention above, the SHA256 of the MUMPS source code archive .tar.gz is not checked for the MUMPS versions not in libraries.json. I based this new arbitrary MUMPS version selection off the Makefile for each version, but there may be omissions/mistakes. So please let me know how it works for you.

Currently you can select any MUMPS >= 4.8 by this means.

eike-fokken commented 3 years ago

Thanks for the quick response! It works for me with the main branch. But after familiarizing myself with this feature of CMakes FetchContent, I think this behaviour would surprise users (not checking the sha256). Maybe its better to just include

      "4.10.0": {
          "sha256": "d0f86f91a74c51a17a2ff1be9c9cee2338976f13a6d00896ba5b43a5ca05d933",
          "urls": ["http://mumps.enseeiht.fr/MUMPS_4.10.0.tar.gz",
                   "http://graal.ens-lyon.fr/MUMPS/MUMPS_4.10.0.tar.gz"
          ]
      },

(please verify the sha256).

Sorry, I would do a PR, can do that tomorrow, if its easier for you. Considering the connection to graal is not encrypted, I really prefer checking the sha256 and not giving the user the option to forego it.

scivision commented 3 years ago

Yes I agree that's it's too surprising to allow non-HTTPS without hash. I think it's just a few MUMPS versions that people are interested in, and it's easy enough to type several version hashes into the JSON file. Thanks.

eike-fokken commented 3 years ago

Oh, cool! Thanks again for the prompt response!