scsr-calc

This script computes H, G, A1 and A2 electron dynamics matrices

Examples:

Run A2 & G with 200 steps:

scsr-calc A2 G -p steps=200

Run A2 & G with multiprocessing, with 200 steps and lc = 4 and Kx = (0,1,2,3):

scsr-calc A2 G -p lc=4 steps=200 -x -v Kx=0:3

Run A2 & G with multiprocessing, with 200 steps for 6 equally-spaced w. w values from 0-3:

scsr-calc A2 G -p steps=200 -x -v w=0:3:6

Run A2 & G with 100 steps, then write to file:

scsr-calc A2 G -p steps=100 -w

Run A2 & G with 100 steps, then write to file called “A2_G_100_steps.pkl”

scsr-calc A2 G -p steps=100 -w -o A2_G_100_steps.pkl

Output: Files are written as python pickles. Pickles can be read from a new python session using:

import pickle
result = pickle.load(open('output.pkl', 'rb'))

Or, more conveniently, using the scsr.results.load_results function, which returns a results object corresponding to the type of pickle. It expects a list of 1 (or more, if chunking is used) pickle path(s), as it also deals with compiling results from chunked scsr-calc commands:

from scsr.results import load_results
results = load_results(['out.1.pkl', 'out.2.pkl'])

Parameters:

tau, w, L, Nf_m, Vf, Kx, Ln, Ky, P, wp, lc

  • steps: The number of discrete steps in theta/phi axes. (The theta by phi grid is steps^2).

  • theta_max: The maximum value of theta.

  • phi_max: The maximum value of phi.

  • max_tile_size: The max size of the tile of a m by n function matrix to compute at once. Default is (2,2), but you may get significant performance boosts if you increase this - especially in GPU mode.

  • mp_batch_size: The number of function arrays to process before sending them to the main thread (No need to adjust).

usage: scsr-calc [-h] [-p P=V [P=V ...]]
                 [-v P=V1,V2,..,VN [P=V1,V2,..,VN ...]] [-d {64,128,256}] [-x]
                 [-g] [-G GPU_IDS [GPU_IDS ...] | -A] [-m SUBPROCESS_COUNT]
                 [-w] [-E] [-o OUTPUT] [-f] [-u seconds] [-C CHUNKS]
                 [-P CHUNK_PARAMETER] [-I CHUNK_ID]
                 [{H,G,A1,A2} ...]

Inputs

functions

Possible choices: H, G, A1, A2

Functions.

Default: {’H’, ‘G’, ‘A1’, ‘A2’}

-p, --params

Parameters to override. space-separated list of ‘[PARAM]=[VALUE]’ pairs.

-v, --variable-params

Variable parameters to override. Space-separated list of ‘[PARAM]=[VALUE1],[…],[VALUEN]’ items. Values can either be a single value or a range of values. Ranges of consecutive whole numbers can be specified as ‘A:B’, where A and B are integers. Ranges of floating point numbers can be specified as ‘[VALUEA]:[VALUEB]:[STEPS]’, where steps is the number of steps

-d, --dtype

Possible choices: 64, 128, 256

Complex data type to use for calculations.

Default: “128”

Processing

-x, --use-subprocesses

Use subprocesses.

Default: False

-g, --gpu

Use the GPU. Requires a CUDA-enabled GPU and CuPy to be installed.

Default: False

-G, --gpu-ids

Id(s) of GPUs)s to use. Default’s to the first available cuda-capable gpu. Implies –gpu.

-A, --all-gpus

Use all available GPUs. Implies –gpu.

-m, --subprocess-count

Use this many subprocesses. Defaults to the processor core count, unless –gpu is specified, in which case it defaults to 1 per GPU in use.

Output

-w, --write

Write a pickle file with the resultant array.

Default: False

-E, --epsilon-only

Only include epsilon values in the results.

Default: False

-o, --output

Output pickle file path. Defaults to ‘results/output.pkl’.

-f, --force

Overwrite pickle file path it exists. Will generate a unique name by default.

Default: False

-u, --min-update-interval

Min interval (seconds) between progress bar updates.

Default: 0.05

Chunking

-C, --chunks

Number of chunks.

Default: 1

-P, --chunk-parameter

Parameter on which to chunk. Defaults to variable parameter with the most values.

-I, --chunk-id

Chunk id. (from 1 to --chunks)