Test-suite
This page show how to use the PERL or Python test-suites
This web-page show how to install and use the test-suite of Lumen.
We present both test-suites the old one in Perl and the new one in Python
Instructions in red are meant only for developers with access to the private lumen-robots repository and credentials for the ftp server
- Clone the repository:
$git clone git@gitlab.com:lumen-code/lumen-tests.git>$cd lumen-tests - Only for developers: use global ROBOTS submodule.
- Init and update sub-modules in ROBOTS folder:
$git submodule init$git submodule update - Go in ROBOTS folder, checkout the master, and update it:
$cd ROBOTS$git checkout master$git pull - Replace "TOSET" with provided credentials in FTP_credentials file, and go back to the main folder:
$vim FTP_credentials.pl$cd ..
- Init and update sub-modules in ROBOTS folder:
- Configure with the command:
$./configure --with-yambo={path to lumen source} --with-machinename $machinename
For developers: it is advised to choose a machinename
Notice that the configure requires that YamboPy to be installed on your system - Download tests:
$./perltest_lumen.pl -d all
PERL test-suite
Basic usage
- Run you first test
$./perltest_lumen.pl -keys nopj -tests CH4 -compdir="{path to lumen compiled code}" - Now re-run the full test-suite in background.
$nohup ./perltest_lumen.pl -keys all -tests all -compdir="{path to lumen compiled code}" & - Only for developers: to save and upload results to the lumen website add the - report option
$nohup ./perltest_lumen.pl -keys all -tests all -compdir="{path to lumen compiled code}" -report &
Note: the-reportoption combines two different actions, which can be achieved independently:- local storage of the files inside backup_and_www_folder. This can be done using the option
-bat runtime. - upload to the php server of the runs stored inside backup_and_www_folder. This can be done also in a second step with the option
-php "$branchname $compiler"
- local storage of the files inside backup_and_www_folder. This can be done using the option
Advanced usage
Inside the robots folders there are different files which are connected to your machine and username, under ROBOTS/$machine_name/$user_name/ which where created with you did the ./configure step
Running a specific branch
Inside
$vim ROBOTS/$machine_name/$user_name/BRANCHES
you will find the line created by the configure
{path to lumen source} any
You can replace it with multiple lines, such as
{path1} master
{path2} develop
After doing this, each time you run the test-suite you will have to add the option -branch $branch_name. For example
$nohup ./perltest_lumen.pl -keys all -tests all -compdir="{path to lumen compiled code}" -branch master &
Running a flow with automatic compilation
Inside ROBOTS/$machine_name/$user_name/FLOWS you will find files with the possible flows to be used. Here an example
$vim ROBOTS/$machine_name/$user_name/FLOWS/gfortran15.2_openmpi5.0_SP_p4.pl
contains
#!/usr/bin/perl
#
#General RUN descriptor & Automatic flows of calculations
#--------------------------------------------------------
#{
# BRANCH => "PATH", #Full path to the yambo source to test (SAVED)
# CONFIG => "gfortran_slk.sh", # (SAVED)
# ACTIVE => "yes", # can be yes or no
# MPI_CPU => "NP",
# SLK_CPU => "NM",
# THREADS => "NT",
# TESTS => "hBN/GW-OPTICS", # (SAVED)
# KEYS => "nopj elph hard bse rpa", # (SAVED)
# PAR_MODE => "TEXT", # (TEXT can be default, random, loop)
#},
#
@flow = (
{
ACTIVE => "yes",
TESTS => "all",
CONFIG => "gfortran15.2_openmpi5.0_SP.sh",
KEYS => "all hard",
},
{
MPI_CPU => 4,
PAR_MODE => "random",
},
{
MPI_CPU => 4,
PAR_MODE => "default",
},
{
MPI_CPU => 2,
THREADS => 2,
PAR_MODE => "random",
}
);
You can specify the number of cores, the parallelization scheme (random vs default), and the number of threads for each run. Finally you can also provide a config file for automatic compilation which should be inside the ROBOTS/$machine_name/$user_name/CONFIGURATIONS folder.
Having set up a flow you can run (with -report for developers)
$nohup ./perltest_lumen.pl -flow gfortran15.2_openmpi5.0_SP_p4 -branch master -report &
More
TO DO
Python test-suite
The python test-suite is still experimental, simpler and more modular than the perl test-suite. First of all it is split into 3 independent python scripts:
pycompile_lumen.pypytest_lumen.pypreport_lumen.py
These 3 scripts share a configuration file in yaml libs_python/config.yaml. Below an example:
parameters:
gs_mode: "SAVE" # SAVE qe abi
tests_dir: "TESTS/MAIN"
scratch: "./scratch_python"
lumen_src: "LUMEN_SOURCE_FOLDER"
lumen_conf: "L"
lumen_dir: "LUMEN_INSTALL_FOLDER"
lumen_exe: "yambo"
lpp_exe: "ypp"
p2l_exe: "p2y"
a2l_exe: "a2y"
#abi_dir: "ABINIT_INSTALL_FOLDER/bin"
#abi_exe: "abinit"
#qe_dir: "QE_INSTALL_FOLDER/bin"
#qe_exe: "pw.x"
#lph_dir: "/LETZELPHC_INSTALL_FOLDER/src/src/"
#lph_exe: "lelphc"
nprocs: 8
mpi_launcher: "mpirun"
tollerance: 1.0
tests:
# List of tests
# Warning: do not set / as a last character,
# e.g. Iron: ["abinit/Without-SOC/"] breaks the python script
Al111: [""]
Al_bulk: ["GW-OPTICS","ELPH"]
Benzene: ["GW-OPTICS","MAGNETIC"]
CH4: ["Distorted_A","Distorted_B","Distorted_A_fcc","Symmetric","Symmetric_b3lyp","MAGNETIC"]
hBN: ["GW-OPTICS","GW-ANISOTROPY","GW-SHIFTED/SHIFTED","NONDIAGCELL","YPP","SC","RT"] #,"GW-SHIFTED/REGULAR"
He: ["GW"] #P2Y
LiF: ["GW-OPTICS"]
NiBr2: ["Without-SOC/GW-OPTICS"] #,"With-SOC/GW-OPTICS"]
SiH4: [""]
Si_surface: ["OPTICS"]
C6H3Cl3: [""]
H2: ["OPTICS","RT"]
Iron: ["abinit/Without-SOC","abinit/With-SOC","pwscf/Without-SOC","pwscf/With-SOC"]
MoS2: ["OPTICS-abi/With-SOC","OPTICS-abi/Without-SOC-sp1","OPTICS-abi/Without-SOC-sp2","OPTICS-qe/With-SOC","OPTICS-qe/Without-SOC-sp1","OPTICS-qe/Without-SOC-sp2","RT-qe"]
MoS2: ["OPTICS-abi/With-SOC","OPTICS-abi/Without-SOC-sp1","OPTICS-abi/Without-SOC-sp2","OPTICS-qe/With-SOC","OPTICS-qe/Without-SOC-sp1","OPTICS-qe/Without-SOC-sp2","RT-qe","EXCPH-qe/With-SOC"]
PA_chain: [""]
Si_bulk: ["GW-OPTICS","PBE0","SC","RT","ELPH/base","ELPH/base_bz","ELPH/base_for_BSE","ELPH/OPTICS","ELPH/QP_CTL"]
Si_wire: ["OPTICS"]
# Hybrids
# RT section
AlAs: ["RT"]
# ELPH section
Diamond: ["ELPH1"]
Basic usage
pytest_lumen.py is meant to handle the tests alone. It does not compile the source. It cannot operate complex flows. It does not upload results to the php page. It reads info from the configuration file. The same info can also be passed via command line arguments.
However, at variance with the perl script, it can be used to also handle the ground state generation and conversion, either via abinit or via pw.x, ph.x, and lelphc executable, or directly using the provided lumen databases. The different way of running are controlled by the option gs_mode
Simple example (to fix)
./pytest_lumen.py -tests Si_bulk -np 4 &
The output of a single run is stored inside the scratch folder, under the subfolder dedicated to the gs_mode. Each run is characterized by a string composed by the time at which it is started.
Advanced usage and generation of a flow
Results uploading, and more in general complex flows can be achieved by combining different commands. Here a simple example, which compiles the code and the launches a flow composed by 3 independent runs of the test suite
#!/bin/bash configure="gfortran.sh" machine="giumello-ism" user="USERNAME" echo "$machine $user $" echo "./pycompile_lumen.py -conf ROBOTS/$machine/$user/CONFIGURATIONS/$configure" ./pycompile_lumen.py -conf ROBOTS/$machine/$user/CONFIGURATIONS/$configure echo "./pytest_lumen.py -np 1" ./pytest_lumen.py -np 1 >> ROBOpy_out 2>&1 output1=$(grep -a "SREPORT" ROBOpy_out | tail -1) echo "\n Crontab script: $output1\n" echo "./pytest_lumen.py -np 4" ./pytest_lumen.py -np 4 >> ROBOpy_out 2>&1 output4=$(grep -a "SREPORT" ROBOpy_out | tail -1) echo "\n Crontab script: $output4\n" echo "./pytest_lumen.py -np 8" ./pytest_lumen.py -np 8 >> ROBOpy_out 2>&1 output8=$(grep -a "SREPORT" ROBOpy_out | tail -1) echo "\n Crontab script: $output8\n" ./pyreport_lumen.py -runs "$output1 $output4 $output8" -machine $machine -user $user
For the upload, and compilation step the backup_and_www_folder and the compiler_dir are also used.Credentials for uploading to the php server are loaded from the same file used by the perl test-suite