CFD-GO / TCLB

TCLB - Templated MPI+CUDA/CPU Lattice Boltzmann code
https://tclb.io
GNU General Public License v3.0
178 stars 70 forks source link

Dynamic access in 2D models #447

Closed TravisMitchell closed 8 months ago

TravisMitchell commented 1 year ago

I found that the dynamic access template in new dev requires dx,dy,dz for all models. This is an issue with current 2D models using dynamic access as _dyn(dx,dy).

Associated error message:

cuda.cpp:285:40: error: no matching function for call to ‘DynamicAccess<LatticeAccess<range_int<0, 0, -1, 1>, range_int<1, 0, -2, 1>, range_int<0, 0, -1, 1> > >::load_PhaseF(real_t&, real_t&) const’
  285 | #define PhaseF_dyn(...) acc.load_PhaseF(__VA_ARGS__)
      |                         ~~~~~~~~~~~~~~~^~~~~~~~~~~~~
Dynamics.c:500:27: note: in expansion of macro ‘PhaseF_dyn’
  500 |                 myPhase = PhaseF_dyn(nw_x, nw_y);
      |                           ^~~~~~~~~~
In file included from cuda.cpp:99:
LatticeAccess.inc.cpp:3056:36: note: candidate: ‘template<class dx_t, class dy_t, class dz_t> real_t DynamicAccess<PARENT>::load_PhaseF(const dx_t&, const dy_t&, const dz_t&) const [with dx_t = dx_t; dy_t = dy_t; dz_t = dz_t; PARENT = LatticeAccess<range_int<0, 0, -1, 1>, range_int<1, 0, -2, 1>, range_int<0, 0, -1, 1> >]’
 3056 |   CudaDeviceFunction inline real_t load_PhaseF (const dx_t & dx, const dy_t & dy, const dz_t & dz = range_int<0>()) const {
      |                                    ^~~~~~~~~~~
LatticeAccess.inc.cpp:3056:36: note:   template argument deduction/substitution failed:
cuda.cpp:285:40: note:   couldn’t deduce template parameter ‘dz_t’
  285 | #define PhaseF_dyn(...) acc.load_PhaseF(__VA_ARGS__)
      |                         ~~~~~~~~~~~~~~~^~~~~~~~~~~~~
Dynamics.c:500:27: note: in expansion of macro ‘PhaseF_dyn’
  500 |                 myPhase = PhaseF_dyn(nw_x, nw_y);
      |                           ^~~~~~~~~~
In file included from cuda.cpp:99:
LatticeAccess.inc.cpp:3064:36: note: candidate: ‘template<int dx, int dy, int dz> real_t DynamicAccess<PARENT>::load_PhaseF() const [with int dx = dx; int dy = dy; int dz = dz; PARENT = LatticeAccess<range_int<0, 0, -1, 1>, range_int<1, 0, -2, 1>, range_int<0, 0, -1, 1> >]’
 3064 |   CudaDeviceFunction inline real_t load_PhaseF () const {
      |                                    ^~~~~~~~~~~
LatticeAccess.inc.cpp:3064:36: note:   template argument deduction/substitution failed:
cuda.cpp:285:40: note:   candidate expects 0 arguments, 2 provided
  285 | #define PhaseF_dyn(...) acc.load_PhaseF(__VA_ARGS__)
      |                         ~~~~~~~~~~~~~~~^~~~~~~~~~~~~
Dynamics.c:500:27: note: in expansion of macro ‘PhaseF_dyn’
  500 |                 myPhase = PhaseF_dyn(nw_x, nw_y);
      |                           ^~~~~~~~~~
make[1]: *** [makefile:44: cuda.o] Error 1
make[1]: Leaving directory '#####/CLB/d2q9_pf_velocity'
make: *** [makefile.main:59062: CLB/d2q9_pf_velocity/main] Error 2