atrip/bench/test_main.cxx

64 lines
1.5 KiB
C++

#include <iostream>
#include <atrip.hpp>
#include <ctf.hpp>
#include <bench/hauta.h>
int main(int argc, char** argv) {
MPI_Init(&argc, &argv);
CTF::World world(argc, argv);
const int no(hauta::option<int>(argc, argv, "--no"))
, nv(hauta::option<int>(argc, argv, "--nv"))
;
std::vector<int> symmetries(4, NS)
, vo({nv, no})
, vvoo({nv, nv, no, no})
, ooov({no, no, no, nv})
, vvvo({nv, nv, nv, no})
;
CTF::Tensor<double>
ei(1, ooov.data(), symmetries.data(), world)
, ea(1, vo.data(), symmetries.data(), world)
, Tph(2, vo.data(), symmetries.data(), world)
, Tpphh(4, vvoo.data(), symmetries.data(), world)
, Vpphh(4, vvoo.data(), symmetries.data(), world)
, Vhhhp(4, ooov.data(), symmetries.data(), world)
, Vppph(4, vvvo.data(), symmetries.data(), world)
;
ei.fill_random(-40.0, -2);
ea.fill_random(2, 50);
Tpphh.fill_random(0, 1);
Tph.fill_random(0, 1);
Vpphh.fill_random(0, 1);
Vhhhp.fill_random(0, 1);
Vppph.fill_random(0, 1);
atrip::Atrip::init();
atrip::Atrip::Input in;
in
// Tensors
.with_epsilon_i(&ei)
.with_epsilon_a(&ea)
.with_Tai(&Tph)
.with_Tabij(&Tpphh)
.with_Vabij(&Vpphh)
.with_Vijka(&Vhhhp)
.with_Vabci(&Vppph)
// some options
.with_barrier(false)
.with_iterationMod(100)
;
auto out = atrip::Atrip::run(in);
if (atrip::Atrip::rank == 0)
std::cout << "Energy: " << out.energy << std::endl;
MPI_Finalize();
return 0;
}