Closed Marcel-Rodekamp closed 2 years ago
A first attempt has been made in feature/GPUBasics in this commit. At least with Lattices that use the default methods the GPU support for the Fermion matrix is available. A example:
#include "NSL.hpp"
int main(){
// shortcut the real dtype
typedef double real;
// shortcut the complex dtype
typedef NSL::complex<real> complex;
// Space Time Lattice size:
NSL::size_t Nt = 64;
NSL::size_t Nx = 8;
complex beta = {2.,0.};
// Create a lattice, the Ring lattice uses only the default methods from lattice.tpp allowing a pull copy to GPU
// so far it is undetermined what happens with Square (more tests required)
NSL::Lattice::Ring<complex> Lattice(Nx);
Lattice.to(NSL::GPU());
// Create a test configuration
NSL::Tensor<complex> phi(NSL::GPU(),Nt,Nx); phi.rand();
// Construct the test fermion matrix matrix
NSL::FermionMatrix::HubbardExp M(Lattice,phi,beta);
// Create a test vector to apply the matrix on
NSL::Tensor<complex> psi(NSL::GPU(),Nt,Nx); phi.rand();
// mat vec application runs on the GPU
NSL::Tensor<complex> chi = M.M(psi);
std::cout << chi << std::endl;
return EXIT_SUCCESS;
}
Make the fermion matrix available for the GPU. Maybe we require #96.