fml  0.1-0
Fused Matrix Library
copy.hh
1 // This file is part of fml which is released under the Boost Software
2 // License, Version 1.0. See accompanying file LICENSE or copy at
3 // https://www.boost.org/LICENSE_1_0.txt
4 
5 #ifndef FML_PAR_COPY_H
6 #define FML_PAR_COPY_H
7 #pragma once
8 
9 
10 #include <stdexcept>
11 
12 #include "../_internals/types.hh"
13 
14 #include "comm.hh"
15 #include "parmat.hh"
16 
17 #include "../cpu/cpumat.hh"
18 
19 
20 namespace fml
21 {
22 namespace copy
23 {
24  template <typename REAL>
25  void par2cpu(parmat<REAL> &par, cpumat<REAL> &cpu)
26  {
27  // copy local piece then allreduce
28  }
29 
30  template <typename REAL>
31  cpumat<REAL> par2cpu(parmat<REAL> &par)
32  {
33  cpumat<REAL> cpu(par.nrows(), par.ncols());
34  par2cpu(par, cpu);
35 
36  return cpu;
37  }
38 
39 
40 
41  template <typename REAL>
42  void cpu2par(cpumat<REAL> &cpu, parmat<REAL> &mpi)
43  {
44  // copy from cpu
45  }
46 
47  template <typename REAL>
48  mpimat<REAL> cpu2mpi(cpumat<REAL> &cpu, grid g, int bf_rows=16, int bf_cols=16)
49  {
50  mpimat<REAL> mpi(g, cpu.nrows(), cpu.ncols(), bf_rows, bf_cols);
51  cpu2mpi(cpu, mpi);
52 
53  return mpi;
54  }
55 }
56 }
57 
58 
59 #endif
fml
Core namespace.
Definition: linalgutils.hh:15
fml::copy::cpu2mpi
void cpu2mpi(const cpumat< REAL_IN > &cpu, mpimat< REAL_OUT > &mpi)
Copy data from a CPU object to an MPI object.
Definition: copy.hh:232