I want to use cudaMemset
for non-integer types to tidy the code as below, where I used the glm::vec2
type just as an example.
However, cudaMemset
appears to work only for integers.
So, are there any possible equivalents?
#include <glm/glm.hpp>
#include <cuda.h>
int main(){
glm::vec2* ptr1;
int num = 10;
cudaMallocManaged(&ptr1, num*sizeof(glm::vec2));
cudaMemset(ptr1, {0, 0}, num*sizeof(glm::vec2)); // wish to do sth like this, but it doesn't work
// for (size_t i = 0; i < num; i++) ptr1[i] = {1, 0}; // want to replace this
return 0;
}