How to use polymorphism in CUDA

前端 未结 1 1376
时光说笑
时光说笑 2021-01-18 04:55

I am porting some physics simulation code from C++ to CUDA.

The fundamental algorithm can be understood as: applying an operator to each element of a vector. In pseu

相关标签:
1条回答
  • 2021-01-18 05:23

    Something like this perhaps...

    template <class Op1, class Op2>
    class Composition {...}
    
    template <class Op1, class Op2>
    Composition<Op1, Op2> compose(Op1& op1, Op2& op2) {...}
    
    template<class C>
    void apply(C& c, VecType& vec){...}
    
    0 讨论(0)
提交回复
热议问题