jfowkes / pycutest

Python interface to CUTEst
https://jfowkes.github.io/pycutest/
GNU General Public License v3.0
28 stars 11 forks source link

Better handling of incompatible Fortran compilers #53

Open jfowkes opened 1 year ago

jfowkes commented 1 year ago

A common error amongst our users is when CUTEst is compiled with a different compiler to that which the Python environment is using (see e.g. #2, #7, #14).

By default our automatic shell script installer should pick up the shell default gfortran:

$ gofrtran --version

but for some users this is not the same as that picked up by their Python interpreter:

python3 -c 'import subprocess; subprocess.call(["gfortran", "--version"])’ 

which is what PyCUTEst uses by default.

This situation then leads to the dreaded and very user-unfriendly error:

Traceback (most recent call last):
 File "<stdin>", line 1, in <module>
 File ".../python3.6/site-packages/pycutest/build_interface.py", line 347, in import_problem
   drop_fixed_variables=drop_fixed_variables)
 File ".../python3.6/site-packages/pycutest/problem_class.py", line 52, in __new__
   [module.info](http://module.info/) = module.setup() # setup CUTEst problem
 File ".../CUTEST/pycutest_cache/pycutest_cache_holder/ARGLALE_M200_N100/__init__.py", line 69, in setup
   (n, m)=_pycutestitf.dims()
Exception: Failed to open data file

The question is, can we handle this error more gracefully than at present?

Should we change the shell script to automatically detect the python gfortran?