Skip to content

Lyncs-API/lyncs.DDalphaAMG

Repository files navigation

A Python interface to the DDalphaAMG multigrid solver library

python pypi license build & test codecov pylint black

This package provides a Python interface to DDalphaAMG. DDalphaAMG is a solver library for inverting Wilson Clover and Twisted Mass fermions from lattice QCD. It provides an implementation of an adaptive aggregation-based algebraic multigrid ($\alpha$AMG) method.

Installation

NOTE: lyncs_DDalphaAMG requires a working MPI installation. This can be installed via apt-get:

sudo apt-get install libopenmpi-dev openmpi-bin

OR using conda:

conda install -c anaconda mpi4py

The package can be installed via pip:

pip install [--user] lyncs_DDalphaAMG

Documentation

The functions provided by the DDalphaAMG API are available in the Solver class lyncs_DDalphaAMG.Solver. Please, use help(Solver) to see an overview of the functionalities. In the following we present some examples on the usage of the package.

from lyncs_DDalphaAMG import Solver

# Creating the solver
solver = Solver(global_lattice=[4, 4, 4, 4],
       	 	kappa=0.125)

# Reading the configurations
conf = solver.read_configuration("test/conf.random")
plaq = solver.set_configuration(conf)
print("Plaquette:", plaq)

# Computing the solution of a random vector
vector = solver.random()
result = solver.solve(vector)

The above example is run locally and all the fields are numpy arrays.

The Solver class is also Dask compatible and by giving a distributed communicator, as in the following example, the solver instance is now distributed remotely on the dask workers and all the fields are Dask arrays.

from lyncs_mpi import Client

# Creating a client with 4 workers
client = Client(num_workers = 4)
comm = client.create_comm()
procs = [2, 2, 1, 1]
comm = comms.create_cart(procs)

solver = Solver(global_lattice=[4, 4, 4, 4],
       	 	comm = comm,
       	 	kappa=0.125)
		
# Continues as above

About

Interface to sbacchio/DDalphaAMG

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published