...\TestSol\TestLib\tf1.cuh
Код: Выделить всё
#include
#include
__device__ void setTo0(int32_t* p);
Код: Выделить всё
#include "tf1.cuh"
__device__ void setTo0(int32_t* p) {
*p = 0;
}
Код: Выделить всё
#include
#include
#include
#include "..\TestLib\tf1.cuh"
__global__ void setArrValTo0(int32_t* arr) {
setTo0(&arr[blockIdx.x]);
}
int main() {
int32_t* p;
cudaMalloc(&p, sizeof(int32_t) * 16);
setArrValTo0(p);
int32_t* hp = new int32_t[16];
cudaMemcpy(hp, p, sizeof(int32_t) * 16, cudaMemcpyDeviceToHost);
cudaFree(p);
for (int32_t i = 0; i < 16; ++i) {
std::cout
Подробнее здесь: [url]https://stackoverflow.com/questions/78445752/nvlink-error-undefined-reference-to-z6setto0pi-c-cuda[/url]
Мобильная версия