Skip to content

Commit

Permalink
Merge pull request #406 from electronic-structure/develop
Browse files Browse the repository at this point in the history
Merge to master
  • Loading branch information
toxa81 authored Sep 13, 2019
2 parents 012aa85 + 7c6a85c commit 61445c8
Show file tree
Hide file tree
Showing 145 changed files with 30,942 additions and 27,203 deletions.
5 changes: 4 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ endif()

if (USE_TIMER)
add_definitions("-D__USE_TIMER")
add_definitions("-D__PROFILE")
add_definitions("-D__PROFILE_TIME")
endif()

find_package(MPI REQUIRED)
Expand Down Expand Up @@ -137,7 +139,7 @@ if(USE_CUDA)
endif()

if(USE_NVTX)
add_definitions("-D__GPU_NVTX")
add_definitions("-D__CUDA_NVTX")
set(SYSTEM_LIBRARIES "${SYSTEM_LIBRARIES};-lnvToolsExt")
endif()
endif(USE_CUDA)
Expand Down Expand Up @@ -288,6 +290,7 @@ endif(BUILD_TESTS)

add_subdirectory(apps/atoms)
add_subdirectory(apps/dft_loop)
add_subdirectory(apps/upf)
add_subdirectory(apps/utils)
add_subdirectory(python_module)
add_subdirectory(doc)
71 changes: 69 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@
SIRIUS is a domain specific library for electronic structure calculations. It implements plane wave pseudopotential (PW-PP) and full potential linearized augmented plane wave (FP-LAPW) methods and designed to work with popular community codes such as Exciting, Elk and Quantum ESPRESSO. SIRIUS is written in C++11 with MPI, OpenMP and CUDA programming models.

## Installation
SIRIUS depends on the following libraries: MPI, BLAS, LAPACK, GSL, LibXC, HDF5, spglib, FFTW and optionally on ScaLAPACK, ELPA, MAGMA and CUDA. Some of the libraries (GSL, LibXC, HDF5, spglib, FFTW) can be downloaded and configured automatically by the helper Python script ``prerequisite.py``, other libraries must be provided by a system or a developer. We use CMake as a building tool. To compile and install SIRIUS (assuming that all the libraries are installed in the standard paths) run a cmake command from an empty directory followed by a make command:
SIRIUS depends on the following libraries: MPI, BLAS, LAPACK, GSL, LibXC, HDF5, spglib, FFTW and optionally on ScaLAPACK, ELPA, MAGMA and CUDA.
We use CMake as a building tool.

### Manual installation
The minimal dependencies dependencies (GSL, LibXC, HDF5, spglib, FFTW) can be downloaded and configured automatically by the helper Python script ``prerequisite.py``, other libraries must be provided by a system or a developer. To compile and install SIRIUS (assuming that all the libraries are installed in the standard paths) run a cmake command from an empty directory followed by a make command:
```console
$ mkdir _build
$ cd _build
Expand All @@ -33,7 +37,70 @@ $ mkdir -p libs
$ python prerequisite.py ${PWD}/libs xc spg gsl fftw hdf5
```

Unless the dependencies are installed system wide, set the following
environment variables to the installation path of FFTW, SPGLIB, and LibXC
respectively:
- `FFTWROOT`
- `LIBSPGROOT`
- `LIBXCROOT`
- `HDF5_ROOT`
- `GSL_ROOT_DIR`
- `MAGMAROOT` (optional)
- `MKLROOT` (optional)
- `ELPAROOT` (optional)

## Examples

### Installation on Piz Daint
We provide an EasyBuild script on Piz Daint. See also the [CSCS EasyBuild Documentation](https://user.cscs.ch/computing/compilation/easybuild/).

```console
# obtain the official CSCS easybuild custom repository
git clone https://github.com/eth-cscs/production
export EB_CUSTOM_REPOSITORY=${HOME}/production/easybuild
module load daint-gpu
module load Easybuild-custom/cscs
# install easybuild package
eb SIRIUS-6.2.0-CrayIntel-18.08-cuda-9.1.eb -r
```

After the installation has completed, the module can be loaded using:
```console
module load SIRIUS/6.2.0-CrayIntel-18.08-cuda-9.1
```
For the SIRIUS enabled version of QE use `eb QuantumESPRESSO-6.4-rc1-sirius-CrayIntel-18.08-cuda-9.1.eb -r`.


### Installation via the Spack package manager
[Spack](https://spack.io) is a package manager for supercomputers, Linux and macOS. It makes installing scientifc software easy.

Install spack (if it is not already on your system):
```console
git clone https://github.com/spack/spack.git
. spack/share/spack/setup-env.sh
```

Clone the SIRIUS spack package repository:
```console
git clone https://github.com/simonpintarelli/sirius-spack
spack repo add sirius-spack
```

Install SIRIUS (with CUDA support):
```console
spack install sirius +cuda
```
(see `spack info sirius` for all build options).

Load SIRIUS:
```console
spack load sirius +cuda
```

Consult the [Spack documentation](https://spack.readthedocs.io/en/latest/) for more information on how to use Spack.



### Archlinux
Archlinux users can find SIRIUS in the [AUR](https://aur.archlinux.org/packages/sirius-git/).

## Examples
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6.3.0
6.3.3
57 changes: 33 additions & 24 deletions apps/tests/test_davidson.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,15 @@ void init_wf(K_point* kp__, Wave_functions& phi__, int num_bands__, int num_mag_
}
}

void test_davidson(device_t pu__, double pw_cutoff__, double gk_cutoff__, int N__)
void test_davidson(cmd_args const& args__)
{
auto pu = get_device_t(args__.value<std::string>("device", "CPU"));
auto pw_cutoff = args__.value<double>("pw_cutoff", 30);
auto gk_cutoff = args__.value<double>("gk_cutoff", 10);
auto N = args__.value<int>("N", 1);
auto mpi_grid = args__.value<std::vector<int>>("mpi_grid", {1, 1});
auto solver = args__.value<std::string>("solver", "lapack");

utils::timer t1("test_davidson|setup");

/* create simulation context */
Expand Down Expand Up @@ -78,7 +85,7 @@ void test_davidson(device_t pu__, double pw_cutoff__, double gk_cutoff__, int N_
/* set local part of potential */
std::vector<double> vloc(atype.radial_grid().num_points());
for (int i = 0; i < atype.radial_grid().num_points(); i++) {
double x = atype.radial_grid(i);
//double x = atype.radial_grid(i);
vloc[i] = 0.0; //-atype.zn() / (std::exp(-x * (x + 1)) + x);
}
atype.local_potential(vloc);
Expand All @@ -101,24 +108,28 @@ void test_davidson(device_t pu__, double pw_cutoff__, double gk_cutoff__, int N_
/* lattice constant */
double a{5};
/* set lattice vectors */
ctx.unit_cell().set_lattice_vectors({{a * N__, 0, 0},
{0, a * N__, 0},
{0, 0, a * N__}});
ctx.unit_cell().set_lattice_vectors({{a * N, 0, 0},
{0, a * N, 0},
{0, 0, a * N}});
/* add atoms */
double p = 1.0 / N__;
for (int i = 0; i < N__; i++) {
for (int j = 0; j < N__; j++) {
for (int k = 0; k < N__; k++) {
double p = 1.0 / N;
for (int i = 0; i < N; i++) {
for (int j = 0; j < N; j++) {
for (int k = 0; k < N; k++) {
ctx.unit_cell().add_atom("Cu", {i * p, j * p, k * p});
}
}
}

/* initialize the context */
ctx.set_verbosity(1);
ctx.pw_cutoff(pw_cutoff__);
ctx.gk_cutoff(gk_cutoff__);
ctx.set_processing_unit(pu__);
ctx.pw_cutoff(pw_cutoff);
ctx.gk_cutoff(gk_cutoff);
ctx.set_processing_unit(pu);
ctx.set_mpi_grid_dims(mpi_grid);
ctx.gen_evp_solver_name(solver);
ctx.std_evp_solver_name(solver);

t1.stop();

ctx.set_verbosity(1);
Expand All @@ -145,8 +156,6 @@ void test_davidson(device_t pu__, double pw_cutoff__, double gk_cutoff__, int N_
}
init_wf(&kp, kp.spinor_wave_functions(), ctx.num_bands(), 0);



Hamiltonian H(ctx, pot);
H.prepare();
Band(ctx).solve_pseudo_potential<double_complex>(kp, H);
Expand All @@ -159,8 +168,13 @@ void test_davidson(device_t pu__, double pw_cutoff__, double gk_cutoff__, int N_
}
std::sort(ekin.begin(), ekin.end());

for (int i = 0; i < ctx.num_bands(); i++) {
printf("%20.16f %20.16f %20.16e\n", ekin[i], kp.band_energy(i, 0), std::abs(ekin[i] - kp.band_energy(i, 0)));
if (Communicator::world().rank() == 0) {
double max_diff = 0;
for (int i = 0; i < ctx.num_bands(); i++) {
max_diff = std::max(max_diff, std::abs(ekin[i] - kp.band_energy(i, 0)));
//printf("%20.16f %20.16f %20.16e\n", ekin[i], kp.band_energy(i, 0), std::abs(ekin[i] - kp.band_energy(i, 0)));
}
printf("maximum eigen-value difference: %20.16e\n", max_diff);
}
}

Expand Down Expand Up @@ -232,7 +246,8 @@ int main(int argn, char** argv)
{"pw_cutoff=", "(double) plane-wave cutoff for density and potential"},
{"gk_cutoff=", "(double) plane-wave cutoff for wave-functions"},
{"N=", "(int) cell multiplicity"},
{"mpi_grid=", "(int[2]) dimensions of the MPI grid for band diagonalization"}
{"mpi_grid=", "(int[2]) dimensions of the MPI grid for band diagonalization"},
{"solver=", "eigen-value solver"}
});

if (args.exist("help")) {
Expand All @@ -241,14 +256,8 @@ int main(int argn, char** argv)
return 0;
}

auto pu = get_device_t(args.value<std::string>("device", "CPU"));
auto pw_cutoff = args.value<double>("pw_cutoff", 30);
auto gk_cutoff = args.value<double>("gk_cutoff", 10);
auto N = args.value<int>("N", 1);
auto mpi_grid = args.value<std::vector<int>>("mpi_grid", {1, 1});

sirius::initialize(1);
test_davidson(pu, pw_cutoff, gk_cutoff, N);
test_davidson(args);
int rank = Communicator::world().rank();
sirius::finalize();
if (!rank) {
Expand Down
6 changes: 3 additions & 3 deletions apps/unit_tests/test_mempool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,9 +190,9 @@ void test7()
if (mp.free_size() != mp.total_size()) {
throw std::runtime_error("wrong free size");
}
if (mp.num_blocks() != 1) {
throw std::runtime_error("wrong number of blocks");
}
//if (mp.num_blocks() != 1) {
// throw std::runtime_error("wrong number of blocks");
//}
if (mp.num_stored_ptr() != 0) {
throw std::runtime_error("wrong number of stored pointers");
}
Expand Down
11 changes: 11 additions & 0 deletions apps/upf/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
install(
PROGRAMS
${CMAKE_SOURCE_DIR}/apps/upf/upf_to_json
DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)

install(
FILES
${CMAKE_SOURCE_DIR}/apps/upf/upf_to_json.py
${CMAKE_SOURCE_DIR}/apps/upf/upf2_to_json.py
${CMAKE_SOURCE_DIR}/apps/upf/upf1_to_json.py
DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
3 changes: 3 additions & 0 deletions apps/upf/upf_to_json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/sh

python $(dirname $0)/upf_to_json.py $@
Loading

0 comments on commit 61445c8

Please sign in to comment.