1#ifndef __GENERATE_ALM_BLOCK_HPP__
2#define __GENERATE_ALM_BLOCK_HPP__
10template <
bool conjugate,
typename T>
14 PROFILE(
"sirius::generate_alm_block");
17 std::vector<int> mt_aw_offset(num_atoms__);
18 for (
int ia = 0; ia < num_atoms__; ia++) {
19 mt_aw_offset[ia] = num_mt_aw;
20 num_mt_aw += ctx__.unit_cell().atom(atom_begin__ + ia).mt_aw_basis_size();
24 switch (ctx__.processing_unit()) {
25 case sddk::device_t::CPU: {
27 get_memory_pool(sddk::memory_t::host),
"alm_block");
30 case sddk::device_t::GPU: {
32 get_memory_pool(sddk::memory_t::host_pinned),
"alm_block");
33 result.
allocate(get_memory_pool(sddk::memory_t::device));
40 int tid = omp_get_thread_num();
42 for (
int i = 0; i < num_atoms__; i++) {
43 auto& atom = ctx__.unit_cell().atom(atom_begin__ + i);
44 auto& type = atom.type();
47 switch (ctx__.processing_unit()) {
48 case sddk::device_t::CPU: {
50 alm__.gkvec().count(), type.mt_aw_basis_size(),
"alm_atom");
53 case sddk::device_t::GPU: {
55 result.at(sddk::memory_t::device, 0, mt_aw_offset[i]),
56 alm__.gkvec().count(), type.mt_aw_basis_size(),
"alm_atom");
61 alm__.template generate<conjugate>(atom, alm_atom);
62 if (ctx__.processing_unit() == sddk::device_t::GPU) {
67 if (ctx__.processing_unit() == sddk::device_t::GPU) {
Simulation context is a set of parameters and objects describing a single simulation.
Helper class to wrap stream id (integer number).
Multidimensional array with the column-major (Fortran) order.
void copy_to(memory_t mem__, size_t idx0__, size_t n__, acc::stream_id sid=acc::stream_id(-1))
Copy n elements starting from idx0 from one memory type to another.
mdarray< T, N > & allocate(memory_t memory__)
Allocate memory for array.
Contains definition and partial implementation of sirius::Matching_coefficients class.
void sync_stream(stream_id sid__)
Synchronize a single stream.
Namespace of the SIRIUS library.
auto generate_alm_block(Simulation_context const &ctx__, int atom_begin__, int num_atoms__, Matching_coefficients const &alm__)
Generate matching coefficients for a block of atoms.
Contains definition and implementation of Simulation_context class.