Commit 3dae0b08 authored by Mark Kim's avatar Mark Kim

CUDA can still be finicky.

parent e7c1151c
......@@ -31,9 +31,11 @@
#include <vtkm/cont/testing/Testing.h>
#include <vtkm/worklet/zfp/ZFPTools.h>
#include <algorithm>
#include <fstream>
#include <iostream>
template <typename T>
void writeArray(vtkm::cont::ArrayHandle<T>& field, std::string filename)
{
......@@ -80,6 +82,12 @@ void Test1D(int rate)
//writeArray(compressed, "output.zfp");
vtkm::cont::ArrayHandle<Scalar> decoded;
decompressor.Decompress(compressed, decoded, rate, dims);
auto oport = decoded.GetPortalConstControl();
for (int i = 0; i < 4; i++)
{
std::cout << oport.Get(i) << " " << fPortal.Get(i) << " " << oport.Get(i) - fPortal.Get(i)
<< std::endl;
}
}
}
template <typename Scalar>
......@@ -111,6 +119,12 @@ void Test2D(int rate)
auto compressed = compressor.Compress(handle, rate, dims);
vtkm::cont::ArrayHandle<Scalar> decoded;
decompressor.Decompress(compressed, decoded, rate, dims);
auto oport = decoded.GetPortalConstControl();
for (int i = 0; i < 4; i++)
{
std::cout << oport.Get(i) << " " << fPortal.Get(i) << " " << oport.Get(i) - fPortal.Get(i)
<< std::endl;
}
}
}
template <typename Scalar>
......@@ -147,6 +161,12 @@ void Test3D(int rate)
vtkm::cont::ArrayHandle<Scalar> decoded;
decompressor.Decompress(compressed, decoded, rate, dims);
auto oport = decoded.GetPortalConstControl();
for (int i = 0; i < 4; i++)
{
std::cout << oport.Get(i) << " " << fPortal.Get(i) << " " << oport.Get(i) - fPortal.Get(i)
<< std::endl;
}
}
}
......@@ -160,7 +180,7 @@ void TestZFP()
//Test3D<vtkm::Int32>(4);
}
int UnitTestZFPCompressor(int, char* [])
int UnitTestZFPCompressor(int argc, char* argv[])
{
return vtkm::cont::testing::Testing::Run(TestZFP);
return vtkm::cont::testing::Testing::Run(TestZFP, argc, argv);
}
......@@ -214,14 +214,6 @@ VTKM_EXEC void decode_ints(ReaderType<BlockSize, PortalType>& reader,
//}
}
template <vtkm::Int32 BlockSize, typename Scalar, typename Int>
void zfp_convert(Scalar inv_w, Scalar* fblock, Int* iblock)
{
for (vtkm::Int32 i = 0; i < BlockSize; ++i)
{
fblock[i] = inv_w * (Scalar)iblock[i];
}
}
template <vtkm::Int32 BlockSize, typename Scalar, typename PortalType>
VTKM_EXEC void zfp_decode(Scalar* fblock,
vtkm::Int32 maxbits,
......@@ -291,7 +283,10 @@ VTKM_EXEC void zfp_decode(Scalar* fblock,
//std::cout<<"dequantize factor "<<inv_w<<"\n";
zfp_convert<BlockSize>(inv_w, fblock, iblock);
for (vtkm::Int32 i = 0; i < BlockSize; ++i)
{
fblock[i] = inv_w * (Scalar)iblock[i];
}
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment