Программы на C++. Форум разработчиков
-
Anonymous
При использовании тяги законно ли создавать std::array внутри функтора __host__ __device__?
Сообщение
Anonymous »
Я написал игрушечный код, чтобы проверить некоторые идеи
Код: Выделить всё
#include
#include
#include
#include
#include
#include
#include
#include
#include
#define N 20
struct func {
__host__ __device__
float operator()(float x) { return x*2; }
};
template
struct O {
const std::array a;
O(std::array a): a(a) {}
S f;
__host__ __device__
float operator()(float &v) {
std::array b = {2,3,4};
int tmp;
for (int i=0; i
Подробнее здесь: [url]https://stackoverflow.com/questions/76271476/when-using-thrust-is-it-legitimate-to-create-a-stdarray-inside-a-host-d[/url]
1730762262
Anonymous
Я написал игрушечный код, чтобы проверить некоторые идеи
[code]#include
#include
#include
#include
#include
#include
#include
#include
#include
#define N 20
struct func {
__host__ __device__
float operator()(float x) { return x*2; }
};
template
struct O {
const std::array a;
O(std::array a): a(a) {}
S f;
__host__ __device__
float operator()(float &v) {
std::array b = {2,3,4};
int tmp;
for (int i=0; i
Подробнее здесь: [url]https://stackoverflow.com/questions/76271476/when-using-thrust-is-it-legitimate-to-create-a-stdarray-inside-a-host-d[/url]