Skip to content

Commit

Permalink
apply format
Browse files Browse the repository at this point in the history
  • Loading branch information
toxa81 committed Jun 26, 2024
1 parent 22909ec commit 6f3eeec
Show file tree
Hide file tree
Showing 41 changed files with 211 additions and 214 deletions.
26 changes: 13 additions & 13 deletions apps/atoms/atom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -848,19 +848,19 @@ int
main(int argn, char** argv)
{
/* handle command line arguments */
cmd_args args(argn, argv, {
{"symbol=", "{string} symbol of a chemical element"},
{"type=", "{lo1, lo2, lo3, LO1, LO2} type of local orbital basis"},
{"core=", "{double} cutoff for core states: energy (in Ha, if <0), radius (in a.u. if >0)"},
{"order=", "{int} order of augmentation; 1: APW, 2: LAPW"},
{"apw_enu=", "{double} default value for APW linearization energies"},
{"auto_enu=", "{int} search algorithm type for linearization energies"},
{"rel", "use scalar-relativistic solver"},
{"num_points=", "{int} number of radial grid points"},
{"rmax=", "{double} maximum value of radial grid"},
{"rmt=", "{double} set specific MT radius"},
{"nrmt=", "{int} number of radial grid points"},
{"lo_tol=", "{double} tolerance on linear dependency of local orbitals"}});
cmd_args args(argn, argv,
{{"symbol=", "{string} symbol of a chemical element"},
{"type=", "{lo1, lo2, lo3, LO1, LO2} type of local orbital basis"},
{"core=", "{double} cutoff for core states: energy (in Ha, if <0), radius (in a.u. if >0)"},
{"order=", "{int} order of augmentation; 1: APW, 2: LAPW"},
{"apw_enu=", "{double} default value for APW linearization energies"},
{"auto_enu=", "{int} search algorithm type for linearization energies"},
{"rel", "use scalar-relativistic solver"},
{"num_points=", "{int} number of radial grid points"},
{"rmax=", "{double} maximum value of radial grid"},
{"rmt=", "{double} set specific MT radius"},
{"nrmt=", "{int} number of radial grid points"},
{"lo_tol=", "{double} tolerance on linear dependency of local orbitals"}});

if (argn == 1 || args.exist("help")) {
std::cout << std::endl;
Expand Down
10 changes: 5 additions & 5 deletions apps/hydrogen/hydrogen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ struct level_conf
int
main(int argn, char** argv)
{
cmd_args args(argn, argv, {
{"grid_type=", "{int} type of the radial grid"},
{"num_points=", "{int} number of grid points"},
{"rmin=", "{double} first grid point"},
{"p=", "{double} additional grid parameter"}});
cmd_args args(argn, argv,
{{"grid_type=", "{int} type of the radial grid"},
{"num_points=", "{int} number of grid points"},
{"rmin=", "{double} first grid point"},
{"p=", "{double} additional grid parameter"}});

printf("\n");
printf("Test of radial solver for bare nuclear potential V(r) = -z / r \n");
Expand Down
54 changes: 27 additions & 27 deletions apps/mini_app/sirius.scf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -556,33 +556,33 @@ int
main(int argn, char** argv)
{
std::feclearexcept(FE_ALL_EXCEPT);
cmd_args args(argn, argv, {
{"input=", "{string} input file name"},
{"output=", "{string} output file name"},
{"task=", "{int} task id"},
{"aiida_output", "write output for AiiDA"},
{"test_against=", "{string} json file with reference values"},
{"repeat_update=", "{int} number of times to repeat update()"},
{"fpe", "enable check of floating-point exceptions using GNUC library"},
{"control.processing_unit=", ""},
{"control.verbosity=", ""},
{"control.verification=", ""},
{"control.mpi_grid_dims=", ""},
{"control.std_evp_solver_name=", ""},
{"control.gen_evp_solver_name=", ""},
{"control.fft_mode=", ""},
{"control.memory_usage=", ""},
{"parameters.ngridk=", ""},
{"parameters.gamma_point=", ""},
{"parameters.pw_cutoff=", ""},
{"parameters.gk_cutoff=", ""},
{"iterative_solver.orthogonalize=", ""},
{"iterative_solver.early_restart=",
"{double} value between 0 and 1 to control the early restart ratio in Davidson"},
{"mixer.type=", "{string} mixer name (anderson, anderson_stable, broyden2, linear)"},
{"mixer.beta=", "{double} mixing parameter"},
{"volume_scale0=", "{double} starting volume scale for EOS calculation"},
{"volume_scale1=", "{double} final volume scale for EOS calculation"}});
cmd_args args(argn, argv,
{{"input=", "{string} input file name"},
{"output=", "{string} output file name"},
{"task=", "{int} task id"},
{"aiida_output", "write output for AiiDA"},
{"test_against=", "{string} json file with reference values"},
{"repeat_update=", "{int} number of times to repeat update()"},
{"fpe", "enable check of floating-point exceptions using GNUC library"},
{"control.processing_unit=", ""},
{"control.verbosity=", ""},
{"control.verification=", ""},
{"control.mpi_grid_dims=", ""},
{"control.std_evp_solver_name=", ""},
{"control.gen_evp_solver_name=", ""},
{"control.fft_mode=", ""},
{"control.memory_usage=", ""},
{"parameters.ngridk=", ""},
{"parameters.gamma_point=", ""},
{"parameters.pw_cutoff=", ""},
{"parameters.gk_cutoff=", ""},
{"iterative_solver.orthogonalize=", ""},
{"iterative_solver.early_restart=",
"{double} value between 0 and 1 to control the early restart ratio in Davidson"},
{"mixer.type=", "{string} mixer name (anderson, anderson_stable, broyden2, linear)"},
{"mixer.beta=", "{double} mixing parameter"},
{"volume_scale0=", "{double} starting volume scale for EOS calculation"},
{"volume_scale1=", "{double} final volume scale for EOS calculation"}});

#if defined(_GNU_SOURCE)
if (args.exist("fpe")) {
Expand Down
3 changes: 2 additions & 1 deletion apps/tests/test_atomic_orbital_index.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ test_atomic_orbital_index(cmd_args const& args)
for (int o = 0; o < ri.max_order(l); o++) {
for (auto j : ri.subshell(l, o)) {
auto idx = ri.index_of(j, o);
std::cout << "l : " << ri.am(idx).l() << ", o : " << o << ", s : " << ri.am(idx).s() << ", idx : " << idx << std::endl;
std::cout << "l : " << ri.am(idx).l() << ", o : " << o << ", s : " << ri.am(idx).s()
<< ", idx : " << idx << std::endl;
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions apps/tests/test_blacs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ test_blacs()
#if defined(SIRIUS_SCALAPACK)
std::cout << "self_comm_size : " << mpi::Communicator::self().size()
<< ", self_comm_rank : " << mpi::Communicator::self().rank() << std::endl;
std::cout << "world_comm_size : " << mpi::Communicator::world().size()
<< ", world_comm_rank " << mpi::Communicator::world().rank() << std::endl;
std::cout << "world_comm_size : " << mpi::Communicator::world().size() << ", world_comm_rank "
<< mpi::Communicator::world().rank() << std::endl;

auto blacs_handler = la::linalg_base::create_blacs_handler(mpi::Communicator::self().native());
blacs_handler = la::linalg_base::create_blacs_handler(mpi::Communicator::world().native());
Expand Down
23 changes: 12 additions & 11 deletions apps/tests/test_gemm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ test_gemm_impl(int M, int N, int K, int transa, la::lib_t la__, memory_t memA__,
return perf;
}

int test_gemm(cmd_args const& args__)
int
test_gemm(cmd_args const& args__)
{
int M = args__.value<int>("M", 512);
int N = args__.value<int>("N", 512);
Expand Down Expand Up @@ -108,16 +109,16 @@ int test_gemm(cmd_args const& args__)
int
main(int argn, char** argv)
{
cmd_args args(argn, argv, {
{"M=", "{int} M"},
{"N=", "{int} N"},
{"K=", "{int} K"},
{"opA=", "{0|1|2} 0: op(A) = A, 1: op(A) = A', 2: op(A) = conjg(A')"},
{"repeat=", "{int} repeat test number of times"},
{"lib_t=", "{string} type of the linear algebra driver"},
{"memA=", "{string} type of memory of matrix A"},
{"memB=", "{string} type of memory of matrix B"},
{"memC=", "{string} type of memory of matrix C"}});
cmd_args args(argn, argv,
{{"M=", "{int} M"},
{"N=", "{int} N"},
{"K=", "{int} K"},
{"opA=", "{0|1|2} 0: op(A) = A, 1: op(A) = A', 2: op(A) = conjg(A')"},
{"repeat=", "{int} repeat test number of times"},
{"lib_t=", "{string} type of the linear algebra driver"},
{"memA=", "{string} type of memory of matrix A"},
{"memB=", "{string} type of memory of matrix B"},
{"memC=", "{string} type of memory of matrix C"}});

sirius::initialize(true);
int result = call_test("test_gemm", test_gemm, args);
Expand Down
3 changes: 1 addition & 2 deletions apps/tests/test_gvec_send_recv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ test_gvec_send_recv(cmd_args const& args)
int
main(int argn, char** argv)
{
cmd_args args(argn, argv, {
{"cutoff=", "{double} wave-functions cutoff"}});
cmd_args args(argn, argv, {{"cutoff=", "{double} wave-functions cutoff"}});

sirius::initialize(1);
int result = call_test("test_gvec_send_recv", test_gvec_send_recv, args);
Expand Down
20 changes: 10 additions & 10 deletions apps/tests/test_hloc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,16 +128,16 @@ test_hloc(cmd_args const& args)
int
main(int argn, char** argv)
{
cmd_args args(argn, argv, {
{"mpi_grid_dims=", "{int int} dimensions of MPI grid"},
{"cutoff=", "{double} wave-functions cutoff"},
{"reduce_gvec=", "{int} 0: use full set of G-vectors, 1: use reduced set of G-vectors"},
{"num_bands=", "{int} number of bands"},
{"use_gpu=", "{int} 0: CPU only, 1: hybrid CPU+GPU"},
{"gpu_ptr=", "{int} 0: start from CPU, 1: start from GPU"},
{"repeat=", "{int} number of repetitions"},
{"t_file=", "{string} name of timing output file"},
{"fp32", "use FP32 arithmetics"}});
cmd_args args(argn, argv,
{{"mpi_grid_dims=", "{int int} dimensions of MPI grid"},
{"cutoff=", "{double} wave-functions cutoff"},
{"reduce_gvec=", "{int} 0: use full set of G-vectors, 1: use reduced set of G-vectors"},
{"num_bands=", "{int} number of bands"},
{"use_gpu=", "{int} 0: CPU only, 1: hybrid CPU+GPU"},
{"gpu_ptr=", "{int} 0: start from CPU, 1: start from GPU"},
{"repeat=", "{int} number of repetitions"},
{"t_file=", "{string} name of timing output file"},
{"fp32", "use FP32 arithmetics"}});

sirius::initialize(1);
int result = call_test("test_hloc", test_hloc, args);
Expand Down
3 changes: 2 additions & 1 deletion apps/tests/test_iter_gvec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@

using namespace sirius;

int test_iter_gvec()
int
test_iter_gvec()
{
r3::matrix<double> M({{1, 0, 0}, {0, 1, 0}, {0, 0, 1}});
fft::Gvec gv(M, 10, mpi::Communicator::world(), false);
Expand Down
15 changes: 7 additions & 8 deletions apps/tests/test_mem_alloc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ int
test_mem_alloc(cmd_args const& args)
{
auto sizes = args.value("sizes", std::vector<int>({1024}));
auto M = get_memory_t(args.value<std::string>("memory_t", "host"));
auto M = get_memory_t(args.value<std::string>("memory_t", "host"));

std::vector<char*> ptrs;
for (auto sm : sizes) {
Expand Down Expand Up @@ -44,12 +44,12 @@ test_mem_alloc(cmd_args const& args)
}
auto t4 = time_now();

double fill_time = time_interval(t3, t4);
double fill_time = time_interval(t3, t4);
double allocate_and_fill_time = time_interval(t0, t1) + time_interval(t2, t3);
double allocate_time = allocate_and_fill_time - fill_time;
double allocate_time = allocate_and_fill_time - fill_time;

std::cout << "block size (Mb) : " << sm
<< ", alloc. time : " << allocate_time << ", alloc. speed : " << sm / allocate_time << " Mb/s"
std::cout << "block size (Mb) : " << sm << ", alloc. time : " << allocate_time
<< ", alloc. speed : " << sm / allocate_time << " Mb/s"
<< ", fill time : " << fill_time << ", fill speed : " << sm / fill_time << " Mb/s" << std::endl;
print_memory_usage(std::cout, FILE_LINE);
}
Expand All @@ -62,9 +62,8 @@ test_mem_alloc(cmd_args const& args)
int
main(int argn, char** argv)
{
cmd_args args(argn, argv, {
{"memory_t=", "{string} type of the memory"},
{"sizes=", "{vector} list of chunk sizes in Mb"}});
cmd_args args(argn, argv,
{{"memory_t=", "{string} type of the memory"}, {"sizes=", "{vector} list of chunk sizes in Mb"}});

sirius::initialize(1);
int result = call_test("test_mem_alloc", test_mem_alloc, args);
Expand Down
19 changes: 10 additions & 9 deletions apps/tests/test_mem_pool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ using namespace sirius;
int
test_memory_pool(cmd_args const& args__)
{
auto M = get_memory_t(args__.value<std::string>("memory_t", "host"));
auto nGb = args__.value<size_t>("nGb", 2);
auto M = get_memory_t(args__.value<std::string>("memory_t", "host"));
auto nGb = args__.value<size_t>("nGb", 2);
auto gran = args__.value<uint32_t>("gran", 32);

auto& mpool = get_memory_pool(M);
Expand All @@ -38,27 +38,28 @@ test_memory_pool(cmd_args const& args__)
for (int k = 0; k < 10; k++) {
auto t0 = time_now();
v.clear();
for (auto s: sizes) {
for (auto s : sizes) {
v.push_back(mdarray<char, 1>({s}, mpool));
v.back().zero(M);
}
std::shuffle(v.begin(), v.end(), std::mt19937());
for (auto& e: v) {
for (auto& e : v) {
e.deallocate(M);
}
double t = time_interval(t0);
std::cout << "pass : " << k << ", time : " << t << ", effective throughput : " << tot_size / t / (1 << 20) << " Mb/s\n";
std::cout << "pass : " << k << ", time : " << t << ", effective throughput : " << tot_size / t / (1 << 20)
<< " Mb/s\n";
}
return 0;
}

int
main(int argn, char** argv)
{
cmd_args args(argn, argv, {
{"memory_t=", "{string} type of the memory"},
{"nGb=", "{int} total number of Gigabytes to allocate"},
{"gran=", "{int} block granularity in Mb"}});
cmd_args args(argn, argv,
{{"memory_t=", "{string} type of the memory"},
{"nGb=", "{int} total number of Gigabytes to allocate"},
{"gran=", "{int} block granularity in Mb"}});

sirius::initialize(1);
int result = call_test("test_memory_pool", test_memory_pool, args);
Expand Down
12 changes: 6 additions & 6 deletions apps/tests/test_mixer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,12 +163,12 @@ test_mixer(cmd_args const& args)
int
main(int argn, char** argv)
{
cmd_args args(argn, argv, {
{"max_history=", "{int} maximum number of vecs to store"},
{"beta=", "{double} first jacobian approximation as diagonal matrix"},
{"dim=", "{size_t} problem dimension"},
{"max_iter=", "{int} maximum number of iterations"},
{"tol=", "{double} tolerance"}});
cmd_args args(argn, argv,
{{"max_history=", "{int} maximum number of vecs to store"},
{"beta=", "{double} first jacobian approximation as diagonal matrix"},
{"dim=", "{size_t} problem dimension"},
{"max_iter=", "{int} maximum number of iterations"},
{"tol=", "{double} tolerance"}});

return call_test("test_mixer", test_mixer, args);
}
2 changes: 1 addition & 1 deletion apps/tests/test_mpi_allgather.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ using namespace sirius;
int
test_allgather()
{
int mb{1<<20};
int mb{1 << 20};
int N = 1 * mb;
std::vector<double> vec(N, 0.0);

Expand Down
2 changes: 1 addition & 1 deletion apps/tests/test_mpi_allreduce.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ using namespace sirius;
int
test_allreduce()
{
int mb{1<<20};
int mb{1 << 20};
int N = 100 * mb;
std::vector<int> vec(N, 0);

Expand Down
11 changes: 5 additions & 6 deletions apps/tests/test_mpi_alltoall.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ test_mpi_alltoall_impl(int M__, int N__)

if (comm.rank() == 0) {
printf("number of ranks: %i\n", comm.size());
printf("local buffer size: %f Mb\n",
spl_M.local_size() * N__ * sizeof(std::complex<double>) / double(1 << 20));
printf("local buffer size: %f Mb\n", spl_M.local_size() * N__ * sizeof(std::complex<double>) / double(1 << 20));
}

/* P MPI ranks reshuffle data. Each rank stores N * M / P elements which it sends and receives.
Expand Down Expand Up @@ -80,10 +79,10 @@ test_mpi_alltoall(cmd_args const& args__)
int
main(int argn, char** argv)
{
cmd_args args(argn, argv, {
{"N=", "{int} number of matrix rows"},
{"M=", "{int} number of matrix columns"},
{"repeat=", "{int} repeat test number of times"}});
cmd_args args(argn, argv,
{{"N=", "{int} number of matrix rows"},
{"M=", "{int} number of matrix columns"},
{"repeat=", "{int} repeat test number of times"}});

sirius::initialize(1);
int result = call_test("test_mpi_alltoall", test_mpi_alltoall, args);
Expand Down
7 changes: 3 additions & 4 deletions apps/tests/test_mpi_bcast.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ using namespace sirius;
int
test1(cmd_args const& args__)
{
int mb{1<<20};
int mb{1 << 20};

auto size = args__.value("size", mb);

Expand All @@ -23,7 +23,7 @@ test1(cmd_args const& args__)

/* P MPI ranks broadcast one by one the buffer of `size` bytes. Each of P-1 ranks recieves a copy
* of a buffer. Number of bytes moved across the network: P * (P-1) * size */
int P = mpi::Communicator::world().size();
int P = mpi::Communicator::world().size();
auto t0 = time_now();
for (int r = 0; r < P; r++) {
mpi::Communicator::world().bcast(buf.at(memory_t::host), size, r);
Expand All @@ -39,8 +39,7 @@ test1(cmd_args const& args__)
int
main(int argn, char** argv)
{
cmd_args args(argn, argv, {
{"size=", "buffer size in bytes"}});
cmd_args args(argn, argv, {{"size=", "buffer size in bytes"}});

sirius::initialize(1);
call_test("test_bcast_v2", test1, args);
Expand Down
Loading

0 comments on commit 6f3eeec

Please sign in to comment.