Skip to content

NRL-Plasma-Physics-Division/uqtk-playground

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 

Repository files navigation

uqtk-playground

A place to learn UQTk and PyUQTk.

Building UQTk and PyUQTk with spack

Spack is a package manager that makes installing and using scientific codes in Linux and MacOS easy. Here are the basic steps to use spack to get a working copy of UQTk and PyUQTk on Linux. These instructions assume you are working in Ubuntu Linux, and will even work within Ubuntu running in Windows WSL2. (The steps should be similar on MacOS.)

  1. If you don't have a recent version of the GNU Compiler Collection and other developer tools installed, install them now. (These steps should certainly work for gcc-10, and probably for versions >7.)
> sudo apt update
> sudo apt upgrade # if desired, not necessarily required
> sudo apt install build-essential
> sudo apt install gcc-10 g++-10 gfortran-10
> sudo apt install unzip # also needed by spack
  1. Download and install spack and configure compilers.
> cd $HOME/opt # or wherever you'd like to install spack
> git clone https://github.com/spack/spack.git
> cd spack
> . share/spack/setup-env.sh # for bash/zsh/sh (see docs if not)
> # you may want to add the above line to your .bashrc/.zshrc
> spack compiler find # should add gcc@10.x.y to spack

Update your $HOME/.spack/linux/compilers.yaml file to point to gfortran-10:

compilers
- compiler:
    spec: gcc@10.3.0
    paths:
      cc: /usr/bin/gcc-10
      cxx: /usr/bin/g++-10
      f77: /usr/bin/gfortran-10
      fc: /usr/bin/gfortran-10
    flags: {}
    operating_system: ubuntu20.04
    target: x86_64
    modules: []
    environment: {}
    extra_rpaths: []
  1. Finally, build and install UQTk and PyUQTk:
> spack install uqtk pyuqtk=True %gcc@10.x.y # use x.y from above

If successful, UQTk and PyUQTk will be built in a folder within spack named opt/spack/linux-[distro]-[arch]/gcc-10.[x].[y]/uqtk-3.1.0-[hash], where:

  • distro: your linux distro, probably ubuntu20.04
  • arch: your hardware architecture, perhaps skylake
  • 10.x.y: the subversion of gcc, probably 10.3.0
  • hash: some unique hash associated with the UQTk build

Also, you will have a version of python, numpy, scipy, and matplotlib installed within spack that will be loaded alongside UQTk (and PyUQTk) when you do the next step.

  1. Load the uqtk spack package with the command spack load uqtk. PyUQTk that resides in the uqtk-3.1.0-[hash] folder in spack will be in your PYTHONPATH.

  2. Go through the UQTk User Guide and run some examples located in uqtk-3.1.0-[hash]/examples. Note: some of the examples have legacy Python2 and numpy code that will need to be updated.

About

A place to learn UQTk and PyUQTk

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors