Installation
Requirements
PyCUTEst requires the following software to be installed:
Python 3 (http://www.python.org/)
Python 3 Headers (
apt install python3-devon Ubuntu, already included on macOS)CUTEst (see below)
Please Note: Currently PyCUTEst only supports Mac and Linux. For Windows, PyCUTEst can be used through the Windows Subsystem for Linux, following the Linux installation instructions.
Installing CUTEst
Note that CUTEst must be installed in order for PyCUTEst to work.
Installing CUTEst on Linux
New Approach: Installing CUTEst using Meson
This is the new installation approach using the meson build system, alternative installation approaches are detailed below.
You will need to install meson (apt install meson on Ubuntu) and three packages: SIFDecode, CUTEst and MASTSIF. To keep things simple, clone all three packages into the same directory:
$ mkdir cutest $ cd cutest $ git clone https://github.com/ralna/SIFDecode ./sifdecode $ git clone https://github.com/ralna/CUTEst ./cutest $ git clone https://bitbucket.org/optrove/sif ./mastsif
Note that mastsif contains all the test problem definitions and
is therefore quite large. If you’re short on space you may want to copy
only the *.SIF files for the problems you wish to test on.
First we need to compile and install SIFDecode (requires gfortran and gcc):
$ cd sifdecode $ meson setup builddir $ meson compile -C builddir $ sudo meson install -C builddir
And SIFDecode should run from here. To test that the installation works, issue the command:
$ meson test -C builddir
Now we are ready to install CUTEst in double precision (requires gfortran and gcc):
$ cd ../cutest $ meson setup builddir -Dmodules=false $ meson compile -C builddir $ sudo meson install -C builddir
And CUTEst should run from here. To test that the installation works, issue the command:
$ meson test -C builddir
Finally set the following environment variable in your ~/.bashrc to point to the MASTSIF installation directory used above:
# CUTEst export MASTSIF=/path/to/cutest/mastsif/
It is also possible to install SIFDecode and CUTEst to custom locations using the --prefix argument to meson setup.
In this case you will also need to set the SIFDECODE and CUTEST environment variables to the install prefix.
Traditional Approach: Installing CUTEst using Bash Script
This is the traditional installation approach using the bash install script. You will need to install four packages: ARCHDefs, SIFDecode, CUTEst and MASTSIF. To keep things simple, install all four packages in the same directory:
$ mkdir cutest $ cd cutest $ git clone https://github.com/ralna/ARCHDefs ./archdefs $ git clone https://github.com/ralna/SIFDecode ./sifdecode $ git clone https://github.com/ralna/CUTEst ./cutest $ git clone https://bitbucket.org/optrove/sif ./mastsif
Note that mastsif contains all the test problem definitions and
is therefore quite large. If you’re short on space you may want to copy
only the *.SIF files for the problems you wish to test on.
Next set the following environment variables in your ~/.bashrc to point to the installation directories used above:
# CUTEst export ARCHDEFS=/path/to/cutest/archdefs/ export SIFDECODE=/path/to/cutest/sifdecode/ export MASTSIF=/path/to/cutest/mastsif/ export CUTEST=/path/to/cutest/cutest/ export MYARCH="pc64.lnx.gfo"
Now we are ready to install CUTEst in double precision (requires gfortran and gcc):
$ source ~/.bashrc # load above environment variables $ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/jfowkes/pycutest/master/.install_cutest.sh)"
And CUTEst should run from here. To test that the installation works, issue the commands:
$ cd $SIFDECODE/src ; make -f $SIFDECODE/makefiles/$MYARCH test $ cd $CUTEST/src ; make -f $CUTEST/makefiles/$MYARCH test
Please Note: currently PyCUTEst only supports gfortran and uses the default version on your path (as returned by gfortran -v ). Please ensure this is the same version that you install CUTEst with above otherwise you may experience segmentation faults.
Installing CUTEst on Mac
New Approach: Installing CUTEst using Meson
This is the new installation approach using the meson build system, alternative installation approaches are detailed below. First it is important to ensure that you have the latest version of Xcode Command Line Tools installed (or the latest version of Xcode), please ensure this is the case by following this guide. Now install the Homebrew package manager:
$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Then you can easily install GCC and the meson build system:
$ brew install gcc meson
CUTEst can now be installed using the meson build system. You will need to install three packages: SIFDecode, CUTEst and MASTSIF. To keep things simple, clone all three packages into the same directory:
$ mkdir cutest $ cd cutest $ git clone https://github.com/ralna/SIFDecode ./sifdecode $ git clone https://github.com/ralna/CUTEst ./cutest $ git clone https://bitbucket.org/optrove/sif ./mastsif
Note that mastsif contains all the test problem definitions and
is therefore quite large. If you’re short on space you may want to copy
only the *.SIF files for the problems you wish to test on.
First we need to compile and install SIFDecode (requires Homebrew gcc):
$ cd sifdecode $ meson setup builddir $ meson compile -C builddir $ sudo meson install -C builddir
And SIFDecode should run from here. To test that the installation works, issue the command:
$ meson test -C builddir
Now we are ready to install CUTEst in double precision (requires Homebrew gcc):
$ cd ../cutest $ meson setup builddir -Dmodules=false $ meson compile -C builddir $ sudo meson install -C builddir
And CUTEst should run from here. To test that the installation works, issue the command:
$ meson test -C builddir
Finally set the following environment variable in your ~/.zshrc or ~/.bashrc to point to the MASTSIF installation directory used above:
# CUTEst export MASTSIF=/path/to/cutest/mastsif/
It is also possible to install SIFDecode and CUTEst to custom locations using the --prefix argument to meson setup.
In this case you will also need to set the SIFDECODE and CUTEST environment variables to the install prefix.
Anaconda Users: please ensure that ~/.zshrc or ~/.bashrc is sourced in your conda environment (you can do this with the command source ~/.zshrc or source ~/.bashrc ) otherwise you may encounter errors using PyCUTEst.
Please Note: you may see warnings such as ld: warning: object file (RANGE.o) was built for newer macOS version (15.0) than being linked (14.0) . To suppress these warnings please set the environment variable MACOSX_DEPLOYMENT_TARGET to your current macOS version (e.g. export MACOSX_DEPLOYMENT_TARGET=15.0 in this example, you can make this permanent by adding it to your ~/.zshrc or ~/.bashrc file).
Traditional Approach: Installing CUTEst using Bash Script
This is the traditional installation approach using the bash install script. First it is important to ensure that you have the latest version of Xcode Command Line Tools installed (or the latest version of Xcode), please ensure this is the case by following this guide. Now install the Homebrew package manager:
$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Then you can easily install gfortran and gcc:
$ brew install gcc
Next you will need to install four packages: ARCHDefs, SIFDecode, CUTEst and MASTSIF. To keep things simple, install all four packages in the same directory:
$ mkdir cutest $ cd cutest $ git clone https://github.com/ralna/ARCHDefs ./archdefs $ git clone https://github.com/ralna/SIFDecode ./sifdecode $ git clone https://github.com/ralna/CUTEst ./cutest $ git clone https://bitbucket.org/optrove/sif ./mastsif
Note that mastsif contains all the test problem definitions and
is therefore quite large. If you’re short on space you may want to copy
only the *.SIF files for the problems you wish to test on.
Next set the following environment variables in your ~/.zshrc (or ~/.bashrc) to point to the installation directories used above:
# CUTEst export ARCHDEFS=/path/to/cutest/archdefs/ export SIFDECODE=/path/to/cutest/sifdecode/ export MASTSIF=/path/to/cutest/mastsif/ export CUTEST=/path/to/cutest/cutest/ export MYARCH="mac64.osx.gfo"
Now we are ready to install CUTEst in double precision (requires gfortran and gcc from Homebrew):
$ source ~/.zshrc # (or ~/.bashrc) load above environment variables $ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/jfowkes/pycutest/master/.install_cutest_mac.sh)"
And CUTEst should run from here. To test that the installation works, issue the commands:
$ cd $SIFDECODE/src ; make -f $SIFDECODE/makefiles/$MYARCH test $ cd $CUTEST/src ; make -f $CUTEST/makefiles/$MYARCH test
Anaconda Users: please ensure that ~/.zshrc or ~/.bashrc is sourced in your conda environment (you can do this with the command source ~/.zshrc or source ~/.bashrc ) otherwise you may encounter errors using PyCUTEst.
Please Note: you may see warnings such as ld: warning: object file (RANGE.o) was built for newer macOS version (15.0) than being linked (14.0) . To suppress these warnings please set the environment variable MACOSX_DEPLOYMENT_TARGET to your current macOS version (e.g. export MACOSX_DEPLOYMENT_TARGET=15.0 in this example, you can make this permanent by adding it to your ~/.zshrc or ~/.bashrc file).
CUTEst Docker Container
CUTEst can be installed into its own Docker container. Create a file named Dockerfile with the following contents:
FROM continuumio/miniconda3 WORKDIR /cutest RUN apt update RUN apt install -y build-essential git gfortran RUN git clone https://github.com/ralna/ARCHDefs ./archdefs RUN git clone https://github.com/ralna/SIFDecode ./sifdecode RUN git clone https://github.com/ralna/CUTEst ./cutest RUN git clone https://bitbucket.org/optrove/sif ./mastsif ENV ARCHDEFS /cutest/archdefs/ ENV SIFDECODE /cutest/sifdecode/ ENV MASTSIF /cutest/mastsif/ ENV CUTEST /cutest/cutest/ ENV MYARCH "pc64.lnx.gfo" RUN wget https://raw.githubusercontent.com/jfowkes/pycutest/master/.install_cutest.sh RUN chmod +x .install_cutest.sh RUN ./.install_cutest.sh ENTRYPOINT tail -f /dev/null
You can then build, launch, and login to the container in the usual way:
$ docker build -t cutest . # build the container $ docker run --name mycutest -dt cutest # launch the container $ docker exec -it mycutest /bin/bash # login to the container
Please see the docker docs for more details on using docker containers.
Installing PyCUTEst
Please Note: CUTEst must be installed in order for PyCUTEst to work (see Installing CUTEst ).
For easy installation, use pip:
$ pip install pycutest $ pip install --upgrade pycutest # if existing installation on system
With this, PyCUTEst will create a cache folder inside your current working directory. This cache directory is used for compiled problems. You can set a custom cache directory with these commands:
$ mkdir pycutest_cache $ export PYCUTEST_CACHE="/path/to/pycutest_cache"
You can make this permanent by adding the export to your ~/.bashrc file (or ~/.zshrc if using zsh on macOS).
Note that you can uninstall PyCUTEst as follows:
$ pip uninstall pycutest