How to install the integrated code:

A. Fukuyama
Professor Emeritus, Kyoto University
1. Preparation for macOS

2. In case of macOS major version u
3. Preparation for Ubuntu
4. Introduction to git
5. Install task and related libraries
6. Introduction to the task code
7. Install PETSc

Preparation for macOS (1)• Install Xcode– Xcode: development environment on macOS– Use App Store– Category: Development– Choose and install Xcode• Install Command Line Tools– Command Line Tools: various Unix commands– Corresponding to the version of Xcode– xcode-select --install– or download from Apple Developer site

• Install XQartz– Download and install XQartz from https://www.xq• Install java (when necessary)– https://www.java.com/en/download/mac downloa

Preparation for macOS (2)• Install Macports– Macports site: https://www.macports.org– Select tab: Installing MacPorts– Download the MacPorts installer for appropriate– Run the MacPorts installer• Set environmental variables in $HOME/.zproﬁle– Add export PATH=/opt/local/bin:$PATH in .zproﬁl– Add export MANPATH=/opt/local/man:$MANPAT• Install compiler and related modules– sudo port install gmake cmake imake gcc13 mpic
– sudo port select gcc mp-gcc13– sudo port select mpi mpich-mp-fortranPreparation for macOS (3)• To update Macports: (If rsync is available)– sudo port selfupdate– sudo port upgrade outdated• If rsync is not available, port selfupdate will hang

– See https://trac.macports.org/wiki/howto/Syncing– Create the source list
◦ Download the source list in MacPorts server b◦ Modify macports conﬁg to read the source list
– Find outdated ports and upgrade them
◦ Update the source list by git pull
◦ Sync installed with the source list and select ou◦

sudo port upgrade outdated

In case of macOS major version• macOS major version-up: e.g. 14.3=⇒ 15.0• Update Xcode and Command Line Tools for the• Install a new Macports binary for the new version• Migrate Macports: make ports list, uninstall ports,– port -qv installed > myports.txt– port echo requested | cut -d ’ ’ -f 1 | uniq >– sudo port -f uninstall installed– sudo port reclaim– curl -L -O https://github.com/macports/macports-contrib/raw/master/resto– chmod +x restore ports.tcl– xattr -d com.apple.quarantine restore ports.tcl– sudo ./restore ports.tcl myports.txt– sudo port unsetrequested installed– xargs sudo port setrequested < requested.txt• See more detail in https://trac.macports.org/wik

Preparation for Ubuntu
1. Install required modules

sudo apt-get install gfortran-13
sudo apt-get install gcc-13
sudo apt-get install g++-13
sudo apt-get install git
sudo apt-get install xorg-dev
sudo apt-get install valgrind
sudo apt-get install cmakesudo apt-get install python
sudo apt-get install mpichHow to use git (1)• git: version and remote repository control facility• Repositories– local: in your machine– remotes: in remote servers– remotes/origin: in default server: bpsi.nucleng.

• Branches– There are several branches for code develop◦ master: default, stable version, often rather ol◦ develop: latest version, where I am working◦ others: branches for working speciﬁc modules– cd task
– git branch: list branch names, local only
– git branch -a: list branch names, local and r

How to use git (2)• To use task/develop branch (cd task)– Create local branch develop and associate ivelop– git checkout -t -b develop origin/develop– git branch• Change working branch– git checkout master– git checkout develop• Update working branch: download from remote r– git pull
◦ Your modiﬁcation is kept, if committed.
◦ If uncommitted modiﬁcation remains, no overw◦ use git stash to keep away your modiﬁcation.
◦ If there are conﬂicts with your committed moﬂicts are indicated in the ﬁle. Correct them andHow to use git (3)• To check your modiﬁcation– git status• To commit your modiﬁcation with message: onis updated. message is required.
– git commit -a -m’message ’• To list all modiﬁcation– git log

• To show difference from committed repository– git diff [ﬁlename ]• For more detail, visit– https://git-scm.com/documentation

Install TASK (1)• Check availability of git: just command input “git”• Set your identity: To record who changed the cod– git conﬁg - -global user.name “[your-full-name]”– git conﬁg - -global user.email [your-mail-address– For example,◦ git conﬁg - -global user.name “Atsushi Fukuya◦ git conﬁg - -global user.email fukuyama@nucle– Data is saved in $HOME/.gitconﬁg• Create a working directory: any directory name i– mkdir git– cd git

Install TASK (2)• Download TASK and necessary libraries for dow– git clone https://bpsi.nucleng.kyoto-u.ac.jp/pub/g– git clone https://bpsi.nucleng.kyoto-u.ac.jp/pub/g– git clone https://bpsi.nucleng.kyoto-u.ac.jp/pub/g• Download TASK and necessary libraries for dow– git clone ssh://bpsi.nucleng.kyoto-u.ac.jp/pub/git– git clone ssh://bpsi.nucleng.kyoto-u.ac.jp/pub/git– git clone ssh://bpsi.nucleng.kyoto-u.ac.jp/pub/git– bpsi should be replaced by username@bpsi w
remote usernames are different.

• Three directories will be created– gsaf: graphic library– bpsd: data interface library– task: main TASK directory

Install TASK (3)• Install graphic library GSAF

– cd git/gsaf/src– Copy Makeﬁle.arch appropriate for your environm◦ for macOS: cp ../arch/macos-gfortran/Makeﬁle◦ for Ubuntu: cp ../arch/ubuntu-gfortran64-static– Edit Makeﬁle.arch: adjust BINPATH and LIBPAT◦ BINPATH: graphic commands are located, sho$PATH in ∼/.proﬁle or ./zproﬁle◦ LIBPATH: graphic libraries are located, shoulbrary path for compiling applications using the– make– make install◦ if BINPATH is protected, use “sudo make insta

Install TASK (4)• Check the availability of GSAF library– cd test– make– Applications using GSAF library must be started
such as xterm, not from Terminal on macOS.
– ./bsctest– 5: Choose the size of window– c: Continue the run– m– New graphic window opens and marks and lines– To go back to the original window, enter CR.
– If focus does not change, click the original window
preferences.
– e: Close the graphic window– cd ../../..

Install TASK (5)• Conﬁrm the branch is develop and setup make– cd task– git branch (indicated branch should be develo– cp make.header.org make.header– Edit make.header to remove comments for targ

• Compile data exchange library BPSD
– cd ../bpsd– make– cd ../task

Install TASK (6)• Choice of matrix solver conﬁguration– Single processing without MPI: make.mtxp.nomp– Multi processing with single matrix solver:: make– Multi processing with parallel real matrix solver:– Multi processing with parallel real and complex smake.mtxp.petsc+mumps• Modules using parallel matrix solver– Real: fp, ti, pic, t2– Complex: wmx, wf2d, wf2dt, wf2dx, wq• Setup matrix solver library– cd mtxp– cp make.mtxp.XXX make.mtxp– make– cd ..

Install TASK (7)• Compile modules:– cd lib– make– cd ..

• Compile and run TASK module: eq for example– cd eq– make– ./eq
– 5
– c– r– g– s, CR, CR, · · ·– x– q

How to use GSAF
• At the beginning of the program– Set graphic resolution (0: metaﬁle output only,– commands◦ c: continue◦ f: set metaﬁle name and start saving• At the end of one page drawing– commands◦ c or CR: change focus to original window and◦ f: set metaﬁle name and start saving◦ s: start saving and save this page
◦ y: save this page and continue◦ n: continue without saving◦ d: dump this page as a bitmap ﬁle “gsdumpn ”◦ b: switch on/off bell sound◦ q: quit program after conﬁrmation

Graphic Utilities• Utility program– gsview: View metaﬁle– gsprint: Print metaﬁle on a postscript printer– gstoeps: Convert metaﬁle to eps ﬁles of each p– gstops: Convert metaﬁle to a postscript ﬁle of a
– gstotgif: Convert metaﬁle to a tgif ﬁle for graphi– gstotsvg: Convert metaﬁle to a svg ﬁle for web• Options– -a: output all pages, otherwise interactive mode
– -s ps: output from page ps– -e pe: output until page pe– -p np : output contiguous np pages on a sheet– -b: output without title– -r: rotate page
– -z: gray output

Typical File Name of TASK

• XXcomm.f90: Deﬁnition of global variables, allocation• XXmain.f90: Main program for standalone use, read
• XXmenu.f90: Command input• XXinit.f90: Default values• XXparm.f90: Read input parameters• XXview.f90: Show input parameters• XXprep.f90: Initialization of run, initial proﬁle• XXexec.f90: Execution of run• XXgout.f90: Graphic output• XXfout.f90: Text ﬁle output• XXsave.f90: Binary ﬁle output• XXload.f90: Binary ﬁle input

Typical input command• When input line includes =, interpreted as a namelis• When the ﬁrst character is not an alphabet, interpr• r: Initialize proﬁles and execute• c: Continue run• p: Namelist input of input parameters• v: Display of input parameters• s: Save results into a ﬁle• l: Load results from a ﬁle• q: End of the program• Order of input parameter setting– Setting at the subroutine XX init in XXinit.f90– Read a namelist ﬁle XXparm at the beginning of th– Setting by the input line

Install PETSc (1)• PETSc: Parallel matrix solver library– blas,lapack: matrix solver tolls– scalapack, metis, parmetis, blacs, superlu: paral– MUMPS: Direct matrix solver for real and comple– PETSc: Iterative matrix solver for real or comple• Make PETSc directory and change its owner– sudo mkdir /opt/PETSc– sudo chown /opt/PETSc $USERNAME– cd /opt/PETSc• Download latest PETSc library package by git– First download of PETSc source◦git clone -b release https://gitlab.com/pets– In order to update PETSc source◦git pull

Install PETSc (2)• Provide environment variables for PETSC in ∼/.
– export PETSC DIR=/opt/PETSc/petsc– export PETSC ARCH=default• Conﬁgure script in python– Copy default.py to /opt/PETSc/petsc– Provide exec attribute to default.py◦

chmod 755 default.py– Execute conﬁguration script◦(It may take./default.py– Additional libraries are created in default/ext• Make and check PETSc library– make(It may take half an hour.)– make check