Skip to content

SWQU Workshop Installation Instructions

Mac Homebrew


Prerequisites:

  • MUST HAVE ACCESS TO INTERNET

Install the command line developer tools (if not already installed):

Open a terminal and enter:

git --version

This should prompt to install the command line developer tools or show the git version installed.

If prompted to install, follow the instructions.

Install Homebrew (if not already installed):

Run:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Close and re-open the terminal.

Install the requisite packages from Homebrew:

brew install gcc
brew install open-mpi
brew install hdf5-mpi
brew install gnu-sed
brew install htop
brew install python3
brew install ffmpeg
brew install openblas
brew install lapack
brew install qt@5
brew install xterm
brew install libx11

Close and re-open the terminal.

Install python packages from pip3:

pip3 install zenodo_get numpy matplotlib h5py scipy pandas astropy sunpy --break-system-packages

Setup SWQU Installation


Create the main installation folder:

mkdir swqu_workshop
mkdir swqu_workshop/cpu
cd swqu_workshop/cpu

Create a startup script:

touch load_swqu_cpu
chmod +x load_swqu_cpu

Set number of CPU threads

Edit the startup file load_swqu_cpu using a text editor (such as nano or vim) and insert this line:

export OMP_NUM_THREADS=[NUMBER_OF_CPU_THREADS]

You can use tools like htop or sysctl -n hw.logicalcpu to determine [NUMBER_OF_CPU_THREADS].

For Intel-based Macs:

mkdir ~/bin
ln -s /usr/local/bin/gcc-14 ~/bin/gcc
ln -s /usr/local/bin/gfortran-14 ~/bin/gfortran
ln -s /usr/local/bin/gsed ~/bin/sed

For Apple Silicon (M1/2/3)-based Macs:

mkdir ~/bin
ln -s /opt/homebrew/Cellar/gcc/14.1.0/bin/gcc-14 ~/bin/gcc
ln -s /opt/homebrew/bin/gfortran-14 ~/bin/gfortran
ln -s /opt/homebrew/bin/gsed ~/bin/sed  

Add the following line to the load_swqu_cpu startup script:

export PATH=~/bin:$PATH

Source the startup script with the command:

source load_swqu_cpu

Install Open-source Flux Transport (OFT)


Create the OFT installation folder:

mkdir oft
cd oft

Clone the git repository:

git clone --recursive https://github.com/predsci/oft.git/ .

Enter the HipFT directory and build HipFT:

cd hipft
./build_examples/build_gcc_macos_homebrew_cpu.sh

If on an M1/2/3, replace the HDF5 library lines with:

HDF5_INCLUDE_DIR="/opt/homebrew/Cellar/hdf5-mpi/1.14.3_1/include/"
HDF5_LIB_DIR="/opt/homebrew/Cellar/hdf5-mpi/1.14.3_1/lib/"

NOTE! These paths might be slightly different - check them first before adding them.

Test the HipFT installation:

cd testsuite
./run_test_suite.sh
cd ..

Return to the swqu_workshop/cpu folder:

cd ../../

Install Solar Wind Generator (SWiG)


Create the SWiG installation folder:

mkdir swig
cd swig

Clone the git repository:

git clone --recursive https://github.com/predsci/swig.git/ .

Enter the MapFL directory and build MapFL:

cd mapfl
./build_examples/build_cpu_multithread_gcc_macos_homebrew.sh

Test the MapFL installation:

cd examples
../bin/mapfl mapfl_get_simple_open_field_map.in

If the run is sucessful, there should be a file called ofm.h5 in the directory.

Enter the POT3D directory and build POT3D

cd ../../pot3d
./build_examples/build_cpu_mpi-only_gcc_macos_homebrew.sh

If on an M1/2/3, replace the HDF5 library lines with:

HDF5_INCLUDE_DIR="/opt/homebrew/Cellar/hdf5/1.14.3_1/include/"
HDF5_LIB_DIR="/opt/homebrew/Cellar/hdf5/1.14.3_1/lib/"

Test the POT3D installation:

./validate.sh

The validation script will indicate if the run has passed.


Add the following lines to the load_swqu_cpu startup script:

export PATH="<DIR>/swqu_workshop/cpu/oft/bin:$PATH"
export PATH="<DIR>/swqu_workshop/cpu/oft/hipft/bin:$PATH"
export PATH="<DIR>/swqu_workshop/cpu/swig:$PATH"
export PATH="<DIR>/swqu_workshop/cpu/swig/bin:$PATH"
export PATH="<DIR>/swqu_workshop/cpu/swig/pot3d/bin:$PATH"
export PATH="<DIR>/swqu_workshop/cpu/swig/pot3d/scripts:$PATH"

where <DIR> is the path to the directory that swqu_workshop was made in.