starting gpu with thrust

This commit is contained in:
2019-12-10 02:04:36 -05:00
parent 64ee4e53f4
commit eea3c2d414
7 changed files with 326 additions and 0 deletions

28
gpu-slo/util.h Normal file
View File

@@ -0,0 +1,28 @@
#pragma once
#include <thrust/device_vector.h>
#include <thrust/host_vector.h>
#include <iostream>
template<class T>
std::ostream &operator<<(std::ostream &o, const thrust::host_vector<T> &vec) {
if (vec.size() == 0 || vec.size() > 15)
return o << "host_vector{size=" << vec.size() << "}";
o << "[";
for (int i = 0; i < vec.size() - 1; i++) o << vec[i] << ", ";
if (vec.size() > 0) o << vec[vec.size() - 1];
o << "]";
return o;
}
template<class T>
std::ostream &operator<<(std::ostream &o, const thrust::device_vector<T> &vec) {
return o << "device_vector{size=" << vec.size() << "}";
}