THOR (Tensors for High-dimensional Object Representation)

repository·main·Indexed 42 days ago

https://github.com/lanl/thor

A high-performance, multi-GPU library for tensor train format calculations built on Thunder and DRay. It provides utilities and applications for scientific research across Fortran, Matlab, and Python, including Tensor Network Integrators (TNI) for domains such as hydrodynamics (WENO), high-dimensional integration (HDI), and neutron transport.

Tokens
44.2K
Snippets
128
Records
144
Agent score
52%

What's inside THOR

  1. Overview of Tensor Network Integrator capabilities

    main

    The Tensor Network Integrators folder provides MATLAB and Fortran applications for various scientific domains:

    • HDI: Multidimensional numerical integration using low-rank TT.
    • CI: Solving configurational integrals for crystalline solids.
    • Linear-STSC: TT space-time spectral collocation for convection-diffusion-reaction (CDR) equations.
    • Non-linear-STSC: Space-time spectral collocation for nonlinear convection-diffusion equations.
    • Maxwell-Mimetic: Mimetic finite difference method for 3D wave propagation.
    • NTE: Time-independent Boltzmann neutron transport equation.
    • RK-1: Explicit and implicit Runge-Kutta integrators.
    • SWE: High-order finite volume methods for shallow water equations with TT.
    • TENO: TT TENO scheme for compressible flows.
    • WENO: TT WENO scheme for compressible flows.
    • OpInf: TT operator inference.
    • IGA: Isogeometric framework for complex geometries.
    • Multimat: Multimaterial hydrodynamics.
  2. Overview of Tensors for High-dimensional Object Representation (THOR)

    main

    THOR is a multi-GPU implementation of tensors in tensor train format. It is designed for high-performance tensor calculations, manipulation, and research in scientific applications.

    Key technical foundations:

    • Thunder: A modern Fortran MPI/GPU communication library.
    • DRay: A CUDA-enabled algebra of distributed arrays.

    THOR provides utilities and applications across multiple languages, including Fortran, Matlab, and Python.

  3. Use THOR functionality in Matlab

    main
    The Tensor_Network_Integrators/matlab directory provides implementations of THOR (Tensors for High-dimensional Object Representation) functionality and specific applications using the Matlab programming language. Users looking to perform tensor network integrations or high-dimensional object representations within a Matlab environment should look for scripts and functions within this directory.
  4. Install Tensor Network Integrators (TNI)

    main

    To use the Tensor Network Integrators, you must clone the repository recursively to ensure all submodules are included. If you have already cloned the repository without submodules, you can initialize them manually.

    Initial Clone:

    git clone --recursive https://github.com/lanl/thor.git

    Updating existing clone:

    git submodule update --init --recursive
    git clone --recursive https://github.com/lanl/thor.git
  5. Initialize the WENO solver in MATLAB

    main

    Once the TTWENOLIB environment variable is set, you must run the appropriate setup script in your main MATLAB simulation script to initialize the solver components.

    • For Tensor-Train (TT) solvers: Run tt_setup.m.
    • For Full-tensor (FT) solvers: Run ft_setup.m.

    Use the run command combined with getenv to ensure the correct path is used.

    % For TT solver
    run(getenv("TTWENOLIB") + "/tt_setup.m")
    
    % For FT solver
    run(getenv("TTWENOLIB") + "/ft_setup.m")
  6. Install on LANL HPC systems

    main

    Specific installation procedures are provided for LANL HPC environments.

    Darwin

    salloc -p general
    cd fortran
    . load_env.sh intel
    make -j
    make test # optional

    Chicoma

    salloc --qos=debug --reservation=debug --partition=debug
    cd fortran
    . load_env.sh chicoma
    make -j
    make test # optional
    salloc -p general
    cd fortran
    . load_env.sh intel
    make -j
    make test # optional
  7. Set up the WENO library environment

    main

    To use the WENO library in MATLAB, you must define the TTWENOLIB environment variable to point to the root directory of the WENO library. This allows the setup scripts to be located dynamically.

    In MATLAB

    Run the following command in your startup.m file or at the beginning of your session:

    setenv("TTWENOLIB", "/path/of/WENO")

    In a Terminal

    If running MATLAB from a terminal, export the variable before launching MATLAB:

    export TTWENOLIB=/path/of/WENO
    setenv("TTWENOLIB", "/path/of/WENO")
  8. Build the Fortran serial version

    main

    The Fortran applications require manual configuration of a make.inc file before building.

    Build Steps:

    1. Navigate to the fortran directory.
    2. Locate a configuration file in the config subdirectory that matches your system architecture.
    3. Copy that file to the fortran directory and name it make.inc.
    4. Edit make.inc to specify your compiler and the paths to your BLAS/LAPACK libraries.
    5. Run make to build and make test to verify the installation.

    Example Build Workflow:

    git clone git@github.com:lanl/thor.git
    cd thor/TNI/fortran
    cp config/gfortran.inc make.inc
    # <edit make.inc to match your compiler and BLAS/LAPACK paths>
    make -j
    make test # optional
    git clone git@github.com:lanl/thor.git
    cd thor/TNI/fortran
    cp config/gfortran.inc make.inc
    # <edit make.inc>
    make -j
    make test # optional
  9. Install dependencies for Tensor Train Configurational Integral

    main

    To use the Tensor Train Configurational Integral (TTCI) method, ensure the following dependencies are installed and configured in your environment:

    • LAMMPS: Must be installed with Python bindings available.
    • ASE (Atomic Simulation Environment): Required for atomic structure handling.
    • Potential files: You must provide the necessary potential files (e.g., .include, .eam).
    • Structure files: You must provide structure files in LAMMPS format (e.g., .data). If you have .xyz files, they must be converted to .data format first.
  10. Run MATLAB examples in Jupyter Notebooks

    main

    The examples in the examples/ subdirectory are documented as Jupyter notebooks. To run interactive MATLAB code within Jupyter, follow these requirements:

    1. MATLAB: Ensure a working MATLAB installation is available and the matlab command is in your system PATH.
    2. Jupyter: Install Jupyter Notebook following the official instructions.
    3. Proxy: Install the Jupyter-MATLAB proxy.

    Alternative: If you cannot use Jupyter, you can open the notebook files in a browser, copy the MATLAB code, and save it as an *.m file to run directly in MATLAB.