mirror of
https://github.com/marian-nmt/marian.git
synced 2024-11-03 20:13:47 +03:00
move temp() to test.cu
This commit is contained in:
parent
78444bc2eb
commit
32a5985500
@ -39,34 +39,11 @@ std::string Expr::Debug() const
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////
|
||||
#include "tensor_operators.h"
|
||||
|
||||
void temp()
|
||||
{
|
||||
std::vector<float> hVec({1,2, 4,3, 7,9, 7,3});
|
||||
thrust::device_vector<float> dVec(8);
|
||||
thrust::copy(hVec.begin(), hVec.end(), dVec.begin());
|
||||
float *data = thrust::raw_pointer_cast(dVec.data());
|
||||
|
||||
gSoftMax<<<4, 2, sizeof(float)>>>(data, 4, 2);
|
||||
|
||||
std::vector<float> hVec2(8);
|
||||
thrust::copy(dVec.begin(), dVec.end(), hVec2.begin());
|
||||
cerr << "hVec2=";
|
||||
for (size_t i = 0; i < hVec.size(); ++i) {
|
||||
cerr << hVec2[i] << " ";
|
||||
}
|
||||
cerr << endl;
|
||||
}
|
||||
|
||||
ExpressionGraph::ExpressionGraph(int cudaDevice)
|
||||
: stack_(new ChainableStack)
|
||||
{
|
||||
std::srand (time(NULL));
|
||||
cudaSetDevice(0);
|
||||
|
||||
temp();
|
||||
exit(0);
|
||||
}
|
||||
|
||||
}
|
||||
|
23
src/test.cu
23
src/test.cu
@ -3,6 +3,29 @@
|
||||
#include "mnist.h"
|
||||
#include "vocab.h"
|
||||
|
||||
#include "tensor_operators.h"
|
||||
|
||||
///////////////////////////////////////////////////////
|
||||
void temp()
|
||||
{
|
||||
std::vector<float> hVec({1,2, 4,3, 7,9, 7,3});
|
||||
thrust::device_vector<float> dVec(8);
|
||||
thrust::copy(hVec.begin(), hVec.end(), dVec.begin());
|
||||
float *data = thrust::raw_pointer_cast(dVec.data());
|
||||
|
||||
gSoftMax<<<4, 2, sizeof(float)>>>(data, 4, 2);
|
||||
|
||||
std::vector<float> hVec2(8);
|
||||
thrust::copy(dVec.begin(), dVec.end(), hVec2.begin());
|
||||
cerr << "hVec2=";
|
||||
for (size_t i = 0; i < hVec.size(); ++i) {
|
||||
cerr << hVec2[i] << " ";
|
||||
}
|
||||
cerr << endl;
|
||||
exit(0);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////
|
||||
int main(int argc, char** argv) {
|
||||
|
||||
using namespace std;
|
||||
|
Loading…
Reference in New Issue
Block a user