Skip to content

Commit

Permalink
Update master branch (#948)
Browse files Browse the repository at this point in the history
* [update] bump version; add link to discourse.group (#930)

* [refactor] get rid of template in radial_integrals_sum_L3() (#932)

* apply @simonpintarelli proposed code change

* get rid of one more tempale

* default: -> throw, whitespace

* fix

* apply format

---------

Co-authored-by: Simon Pintarelli <[email protected]>

* [fix] subspace initialization in test_lr_solver (#934)

* [cmake] remove std::filesystem target (#936)

std::filesystem is part of C++17 which is required via CXX_STANDARD, there is no
need to check for it explicitly

* [fix] compilation error for ~memory_pool+tests (#939)

* Ci/rebuild base image (#942)

* CI: rebuild base images / pin spack to v0.21
* CI: use anonymous environments instead of dev-build with SPEC
* avoid creating partitions with empty intervals in COSTA `custom_layout`



---------

Co-authored-by: Anton Kozhevnikov <[email protected]>

* [fix] truncate very small occupation numbers to 0 (#943)

* [refactor] minor cleaups (#938)

* minor cleaups
* apply format

* [cmake] add missing REQUIRED (#945)

* [fix] scalar-relativistic radial solver (#941)

Introduce a few fixes for the scalar-relativistic radial solver.

* [feature] port lr_addusdens to sirius (#937)

Use a different sequence of operations to compute G+q augmentation charge.

---------

Co-authored-by: Simon Pintarelli <[email protected]>
Co-authored-by: Simon Pintarelli <[email protected]>
  • Loading branch information
3 people authored Jan 4, 2024
1 parent 8166bae commit 62d3e0a
Show file tree
Hide file tree
Showing 38 changed files with 5,284 additions and 541 deletions.
13 changes: 2 additions & 11 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ include(CMakePackageConfigHelpers)
project(SIRIUS
DESCRIPTION "Domain specific library for electronic structure calculations"
HOMEPAGE_URL "https://github.com/electronic-structure/SIRIUS"
VERSION 7.5.0
VERSION 7.5.1
LANGUAGES CXX C)

# for CUDA_ARCHITECTURES
Expand Down Expand Up @@ -146,15 +146,6 @@ if(NOT SIRIUS_USE_FP32 STREQUAL "OFF")
endif()
endif()

find_package(Filesystem COMPONENTS Final Experimental)

add_library(sirius::filesystem INTERFACE IMPORTED)
target_link_libraries(sirius::filesystem INTERFACE std::filesystem)
target_compile_definitions(sirius::filesystem INTERFACE
$<$<BOOL:${Filesystem_FOUND}>:SIRIUS_STD_FILESYSTEM>
$<$<BOOL:${CXX_FILESYSTEM_IS_EXPERIMENTAL}>:SIRIUS_STD_FILESYSTEM_EXPERIMENTAL>
)

if (SIRIUS_USE_OPENMP)
find_package(OpenMP REQUIRED)
endif()
Expand Down Expand Up @@ -215,7 +206,7 @@ if(SIRIUS_USE_ROCM)
endif()

if(SIRIUS_USE_MEMORY_POOL)
find_package(umpire)
find_package(umpire REQUIRED)
endif()

# check if git command exists
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
</p>

[![GitHub Releases](https://img.shields.io/github/release/electronic-structure/sirius.svg)](https://github.com/electronic-structure/SIRIUS/releases)
[![Forum](https://img.shields.io/badge/user_forum-discourse-blue.svg)](https://sirius-dsl.discourse.group/latest)
[![Documentation](https://img.shields.io/badge/docs-doxygen-blue.svg)](https://electronic-structure.github.io/SIRIUS-doc)
[![Licence](https://img.shields.io/badge/license-BSD-blue.svg)](https://raw.githubusercontent.com/electronic-structure/SIRIUS/master/LICENSE)
[![Build](https://github.com/electronic-structure/SIRIUS/workflows/Build/badge.svg?branch=master)](https://github.com/electronic-structure/SIRIUS/actions)
Expand Down
2 changes: 1 addition & 1 deletion apps/atoms/atom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

using namespace sirius;

double const rmin{1e-5};
double const rmin{1e-6};

class Free_atom : public sirius::Atom_type
{
Expand Down
2 changes: 1 addition & 1 deletion apps/mini_app/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ if(SIRIUS_USE_VCSQNM)
find_package (Eigen3 3.3 REQUIRED NO_MODULE)
endif()
add_executable(sirius.scf sirius.scf.cpp)
target_link_libraries(sirius.scf PRIVATE sirius sirius::filesystem)
target_link_libraries(sirius.scf PRIVATE sirius)
if(SIRIUS_USE_VCSQNM)
target_link_libraries (sirius.scf PRIVATE Eigen3::Eigen sirius)
endif()
Expand Down
2 changes: 1 addition & 1 deletion apps/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ test_mpi_grid;test_enu;test_eigen;test_gemm;test_gemm2;test_wf_inner;test_memop;
test_mem_pool;test_mem_alloc;test_examples;test_bcast_v2;test_p2p_cyclic;\
test_wf_ortho;test_mixer;test_davidson;test_lapw_xc;test_phase;test_bessel;test_fp;test_pppw_xc;\
test_exc_vxc;test_atomic_orbital_index;test_sym;test_blacs;test_reduce;test_comm_split;test_wf_trans;\
test_wf_fft;test_potrf;test_lr_solver")
test_wf_fft;test_potrf;test_lr_solver;test_radial_solver")

foreach(_test ${_tests})
add_executable(${_test} ${_test}.cpp)
Expand Down
65 changes: 37 additions & 28 deletions apps/tests/test_enu.cpp
Original file line number Diff line number Diff line change
@@ -1,52 +1,61 @@
#include <sirius.hpp>
#include "sirius.hpp"
#include "testing.hpp"

using namespace sirius;

void
test_enu(int zn__, int n__, int l__, double R__)
int
test_enu(cmd_args const& args__)
{
auto rgrid = Radial_grid_factory<double>(radial_grid_t::lin_exp, 1500, 1e-7, R__, 6.0);
auto rel = get_relativity_t(args__.value<std::string>("rel", "none"));
auto zn = args__.value<int>("zn", 1);
auto l = args__.value<int>("l", 0);
auto n = args__.value<int>("n", 1);
auto R = args__.value<double>("R", 2.2);

auto rgrid = Radial_grid_factory<double>(radial_grid_t::lin_exp, 1500, 1e-7, R, 6.0);
std::vector<double> v(rgrid.num_points());
for (int ir = 0; ir < rgrid.num_points(); ir++) {
v[ir] = -double(zn__) / rgrid[ir];
v[ir] = -double(zn) / rgrid[ir];
}

Enu_finder e(relativity_t::none, zn__, n__, l__, rgrid, v, -0.1);
Enu_finder e(rel, zn, n, l, rgrid, v, -0.1);

printf("Z: %i n: %i l: %i band energies (bottom, top, enu): %12.6f %12.6f %12.6f\n", zn__, n__, l__, e.ebot(),
e.etop(), e.enu());
printf("Z: %i n: %i l: %i band energies (bottom, top, enu): %12.6f %12.6f %12.6f\n", zn, n, l, e.ebot(), e.etop(),
e.enu());

Radial_solver solver(zn__, v, rgrid);
Radial_solver solver(zn, v, rgrid);

std::vector<double> p1, p2, p3, rdudr;
std::array<double, 2> uderiv;

solver.solve(relativity_t::none, 0, l__, e.ebot(), p1, rdudr, uderiv);
solver.solve(relativity_t::none, 0, l__, e.etop(), p2, rdudr, uderiv);
solver.solve(relativity_t::none, 0, l__, e.enu(), p3, rdudr, uderiv);
int dme{0};

solver.solve(rel, dme, l, e.ebot(), p1, rdudr, uderiv);
solver.solve(rel, dme, l, e.etop(), p2, rdudr, uderiv);
solver.solve(rel, dme, l, e.enu(), p3, rdudr, uderiv);

// printf("uderiv: %12.6f %12.6f\n", uderiv[0], uderiv[1]);
printf("uderiv: %12.6f %12.6f\n", uderiv[0], uderiv[1]);

// FILE* fout = fopen("radial_solution.dat", "w");
// for (int i = 0; i < rgrid.num_points(); i++)
//{
// double x = rgrid[i];
// fprintf(fout, "%18.12f %18.12f %18.12f %18.12f\n", x, p1[i] / x, p2[i] / x, p3[i] / x);
// }
// fclose(fout);
FILE* fout = fopen("radial_solution.dat", "w");
for (int i = 0; i < rgrid.num_points(); i++) {
double x = rgrid[i];
fprintf(fout, "%18.12f %18.12f %18.12f %18.12f\n", x, p1[i] / x, p2[i] / x, p3[i] / x);
}
fclose(fout);
return 0;
}

int
main(int argn, char** argv)
{
cmd_args args(argn, argv,
{{"rel=", "(string) type of scalar-relativistic equation"},
{"zn=", "(int) nuclear charge"},
{"l=", "(int) orbital quantum number"},
{"n=", "(int) principal quantum number"},
{"R=", "(double) muffin-tin radius"}});

sirius::initialize(1);
for (int zn = 1; zn < 100; zn++) {
#pragma omp parallel for
for (int n = 1; n < 7; n++) {
for (int l = 0; l < n; l++) {
test_enu(zn, n, l, 1.5);
}
}
}
call_test("test_enu", test_enu, args);
sirius::finalize();
}
2 changes: 1 addition & 1 deletion apps/tests/test_lr_solver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ solve_lr(Simulation_context& ctx__, std::array<double, 3> vk__, Potential& pot__
Hamiltonian0<T> H0(pot__, true);
auto Hk = H0(kp);
/* initialize kp.spinor_wave_functions */
sirius::initialize_subspace<T, F>(Hk, kp, ctx__.unit_cell().num_ps_atomic_wf().first);
sirius::initialize_subspace<T, std::complex<F>>(Hk, kp, ctx__.unit_cell().num_ps_atomic_wf().first);

/* create auxiliary wave-functions */
auto dpsi = wave_function_factory(ctx__, kp, wf::num_bands(ctx__.num_bands()), wf::num_mag_dims(0), false);
Expand Down
38 changes: 22 additions & 16 deletions apps/tests/test_radial_solver.cpp
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
#include <sirius.h>
#include "sirius.hpp"
#include "testing.hpp"

using namespace sirius;

void
test_radial_solver()
int
test_radial_solver(cmd_args const& args__)
{
Radial_grid_lin_exp<double> rgrid(1500, 1e-7, 2.0);
int zn{38};
auto rel = get_relativity_t(args__.value<std::string>("rel", "none"));
auto zn = args__.value<int>("zn", 1);
auto l = args__.value<int>("l", 0);
auto dme = args__.value<int>("dme", 0);
auto enu = args__.value<double>("enu", -0.5);

Radial_grid_lin_exp<double> rgrid(1500, 1e-7, 3.0);
std::vector<double> v(rgrid.num_points());
for (int ir = 0; ir < rgrid.num_points(); ir++) {
v[ir] = -zn * rgrid.x_inv(ir);
Expand All @@ -15,10 +21,10 @@ test_radial_solver()
Radial_solver rsolver(zn, v, rgrid);
std::vector<double> p, rdudr;
std::array<double, 2> uderiv;
rsolver.solve(relativity_t::iora, 1, 2, -0.524233, p, rdudr, uderiv);
rsolver.solve(rel, dme, l, enu, p, rdudr, uderiv);

std::stringstream s;
s << "radial_functions.dat";
s << "radial_functions_" << args__.value<std::string>("rel", "none") << ".dat";
FILE* fout = fopen(s.str().c_str(), "w");

for (int ir = 0; ir < rgrid.num_points(); ir++) {
Expand All @@ -28,21 +34,21 @@ test_radial_solver()
fprintf(fout, "\n");
}
fclose(fout);

return 0;
}

int
main(int argn, char** argv)
{
cmd_args args;

args.parse_args(argn, argv);
if (args.exist("help")) {
printf("Usage: %s [options]\n", argv[0]);
args.print_help();
return 0;
}
cmd_args args(argn, argv,
{{"rel=", "(string) type of scalar-relativistic equation"},
{"zn=", "(int) nuclear charge"},
{"l=", "(int) orbital quantum number"},
{"enu=", "(double) energy of the equation"},
{"dme=", "(int) energy derivative"}});

sirius::initialize(1);
test_radial_solver();
call_test("test_radial_solver", test_radial_solver, args);
sirius::finalize();
}
74 changes: 46 additions & 28 deletions ci/baseimage.cuda.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ RUN wget https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cm
tar zxvf cmake.tar.gz --strip-components=1 -C /usr

# get latest version of spack
RUN git clone https://github.com/spack/spack.git
RUN git clone -b v0.21.0 https://github.com/spack/spack.git

# set the location of packages built by spack
RUN spack config add config:install_tree:root:/opt/local
Expand All @@ -50,11 +50,9 @@ RUN yq -i '.compilers[0].compiler.paths.f77 = "/usr/bin/gfortran"' /root/.spack/
yq -i '.compilers[1].compiler.paths.fc = "/usr/bin/gfortran"' /root/.spack/linux/compilers.yaml

# install MPICH
RUN spack install --only=dependencies mpich@${MPICH_VERSION} %gcc
RUN spack install mpich@${MPICH_VERSION} %gcc

# install openmpi
RUN spack install --only=dependencies openmpi %gcc
RUN spack install openmpi %gcc

# install libvdwxc
Expand All @@ -71,28 +69,48 @@ RUN spack install nlcglib@master %gcc +cuda
RUN echo $(spack find --format='{prefix.lib}' mpich) > /etc/ld.so.conf.d/mpich.conf
RUN ldconfig

# install dependencies of several basic configurations

RUN spack install --only=dependencies --fail-fast \
"sirius@develop %gcc build_type=RelWithDebInfo +fortran +tests +apps +cuda +scalapack ^mpich ^spfft+single_precision+cuda ^intel-oneapi-mkl+cluster ^umpire+cuda~device_alloc"

RUN spack install --only=dependencies --fail-fast \
"sirius@develop %gcc build_type=RelWithDebInfo +tests +apps +cuda +scalapack +elpa ^mpich ^intel-oneapi-mkl+cluster ^elpa+cuda ^spfft+single_precision+cuda ^umpire+cuda~device_alloc"

RUN spack install --only=dependencies --fail-fast \
"sirius@develop %gcc build_type=RelWithDebInfo +tests +apps +cuda +magma ^mpich ^openblas ^magma+cuda ^umpire+cuda~device_alloc"

RUN spack install --only=dependencies --fail-fast \
"sirius@develop %gcc build_type=RelWithDebInfo +fortran +tests +apps +cuda +scalapack +single_precision ^mpich ^intel-oneapi-mkl+cluster ^umpire+cuda~device_alloc"

RUN spack install --only=dependencies --fail-fast \
"sirius@develop %gcc build_type=RelWithDebInfo +fortran +tests +apps +cuda +scalapack +vdwxc ^mpich ^openblas ^umpire+cuda~device_alloc"

RUN spack install --only=dependencies --fail-fast \
"sirius@develop %gcc build_type=RelWithDebInfo +fortran +tests +apps +vdwxc +cuda +nlcglib ^openblas ^mpich ^nlcglib +cuda ^umpire+cuda~device_alloc"

RUN spack install --only=dependencies --fail-fast \
"sirius@develop %gcc +tests +apps +scalapack +fortran build_type=RelWithDebInfo ^openblas ^openmpi ^umpire~cuda~device_alloc"

RUN spack install --only=dependencies --fail-fast \
"sirius@develop %clang build_type=RelWithDebInfo ~fortran +tests ^openblas%gcc ^libxc%gcc ^mpich%gcc ^umpire~cuda~device_alloc"
# create environments for several configurations and install dependencies
RUN spack env create -d /sirius-env-clang && \
spack -e /sirius-env-clang add "sirius@develop %clang build_type=RelWithDebInfo ~cuda ~fortran +tests ^openblas%gcc ^libxc%gcc ^mpich%gcc " && \
spack -e /sirius-env-clang develop -p /sirius-src sirius@develop && \
spack -e /sirius-env-clang install --only=dependencies --fail-fast

RUN spack env create -d /sirius-env-cuda && \
spack -e /sirius-env-cuda add "sirius@develop %gcc build_type=RelWithDebInfo +scalapack +tests +apps +cuda +magma ^netlib-scalapack ^mpich ^openblas threads=openmp" && \
spack -e /sirius-env-cuda develop -p /sirius-src sirius@develop && \
spack -e /sirius-env-cuda install --only=dependencies --fail-fast

RUN spack env create -d /sirius-env-cuda-mkl-mpich && \
spack -e /sirius-env-cuda-mkl-mpich add "sirius@develop %gcc build_type=RelWithDebInfo +tests +apps +cuda +scalapack +magma ^mpich ^intel-oneapi-mkl+cluster" && \
spack -e /sirius-env-cuda-mkl-mpich develop -p /sirius-src sirius@develop && \
spack -e /sirius-env-cuda-mkl-mpich install --only=dependencies --fail-fast

RUN spack env create -d /sirius-env-elpa && \
spack -e /sirius-env-elpa add "sirius@develop %gcc build_type=RelWithDebInfo +tests +apps +cuda +scalapack +elpa ^netlib-scalapack ^mpich ^openblas ^elpa+cuda" && \
spack -e /sirius-env-elpa develop -p /sirius-src sirius@develop && \
spack -e /sirius-env-elpa install --only=dependencies --fail-fast

RUN spack env create -d /sirius-env-fp32 && \
spack -e /sirius-env-fp32 add "sirius@develop %gcc build_type=RelWithDebInfo +tests +apps +cuda ^mpich ^openblas ^elpa+cuda ^spfft+single_precision+cuda" && \
spack -e /sirius-env-fp32 develop -p /sirius-src sirius@develop && \
spack -e /sirius-env-fp32 install --only=dependencies --fail-fast

RUN spack env create -d /sirius-env-nlcg && \
spack -e /sirius-env-nlcg add "sirius@develop %gcc build_type=RelWithDebInfo +fortran +tests +apps +cuda +nlcglib ^openblas ^mpich" && \
spack -e /sirius-env-nlcg develop -p /sirius-src sirius@develop && \
spack -e /sirius-env-nlcg install --only=dependencies --fail-fast

RUN spack env create -d /sirius-env-openmpi && \
spack -e /sirius-env-openmpi add "sirius@develop %gcc +tests +apps +scalapack +fortran build_type=RelWithDebInfo ^netlib-scalapack ^openblas ^openmpi" && \
spack -e /sirius-env-openmpi develop -p /sirius-src sirius@develop && \
spack -e /sirius-env-openmpi install --only=dependencies --fail-fast

RUN spack env create -d /sirius-env-cuda-sequential && \
spack -e /sirius-env-cuda-sequential add "sirius@develop %gcc +cuda +tests +apps +fortran build_type=RelWithDebInfo ^openblas ^openmpi" && \
spack -e /sirius-env-cuda-sequential develop -p /sirius-src sirius@develop && \
spack -e /sirius-env-cuda-sequential install --only=dependencies --fail-fast

RUN spack env create -d /sirius-env-vdwxc-cuda && \
spack -e /sirius-env-vdwxc-cuda add "sirius@develop %gcc build_type=RelWithDebInfo +fortran +tests +apps +vdwxc +cuda +nlcglib ^openblas ^mpich +cuda" && \
spack -e /sirius-env-vdwxc-cuda develop -p /sirius-src sirius@develop && \
spack -e /sirius-env-vdwxc-cuda install --only=dependencies --fail-fast
15 changes: 8 additions & 7 deletions ci/baseimage.rocm.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ RUN wget https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cm
tar zxvf cmake.tar.gz --strip-components=1 -C /usr

# get latest version of spack
RUN git clone https://github.com/spack/spack.git
RUN git clone -b v0.21.0 https://github.com/spack/spack.git

# set the location of packages built by spack
RUN spack config add config:install_tree:root:/opt/local
Expand All @@ -34,16 +34,17 @@ RUN spack config add packages:all:target:x86_64

# find gcc and clang compilers
RUN spack compiler find
RUN spack external find --all
RUN spack external find --all --exclude ncurses
# workaround hip wants to call /usr/bin/llvm-config, but ubuntu renamed it to /usr/bin/llvm-config-14
RUN ln -s /usr/bin/llvm-config-14 /usr/bin/llvm-config

# install big packages
RUN spack install --fail-fast hip%gcc
RUN spack install --fail-fast rocblas%gcc
RUN spack install --fail-fast rocsolver%gcc
RUN spack install --fail-fast hipfft%gcc

ENV SPEC="sirius@develop %gcc build_type=Release +scalapack +fortran +tests +rocm ^openblas ^mpich ^spfft ^umpire+rocm~device_alloc"

RUN spack spec $SPEC

RUN spack install --fail-fast --only=dependencies $SPEC
RUN spack env create -d /sirius-env-rocm && \
spack -e /sirius-env-rocm add "sirius@develop %gcc build_type=Release +scalapack +fortran +tests +rocm ^openblas ^mpich ^spfft ^umpire+rocm~device_alloc" && \
spack -e /sirius-env-rocm develop -p /sirius-src sirius@develop && \
spack -e /sirius-env-rocm install --only=dependencies --fail-fast
15 changes: 6 additions & 9 deletions ci/build.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
ARG BASE_IMAGE
FROM $BASE_IMAGE

ARG SPECDEV

# show the spack's spec
RUN spack spec -I $SPECDEV

RUN spack env create --with-view /opt/sirius sirius-env
RUN spack -e sirius-env add $SPECDEV
ARG ENVPATH

# copy source files of the pull request into container
COPY . /sirius-src

# build SIRIUS
RUN spack --color always -e sirius-env dev-build --source-path /sirius-src $SPECDEV
RUN spack -e $ENVPATH install

# # show the spack's spec
RUN spack -e $ENVPATH find -lcdv sirius

# we need a fixed name for the build directory
# here is a hacky workaround to link ./spack-build-{hash} to ./spack-build
RUN cd /sirius-src && ln -s $(find . -name "spack-build-*" -type d) spack-build
RUN cd /sirius-src && ln -s $(spack -e $ENVPATH location -b sirius) spack-build
Loading

0 comments on commit 62d3e0a

Please sign in to comment.