Newer
Older
#define BOOST_TEST_DYN_LINK
#define BOOST_TEST_MODULE TestIProductWRTBaseCUDA
#include <boost/test/tools/output_test_stream.hpp>
#include <boost/test/unit_test.hpp>
#include <iostream>
#include <memory>
#include "Operators/OperatorIProductWRTBase.hpp"
#include "init_ipwrtbasefields.hpp"
BOOST_AUTO_TEST_SUITE(TestIProductWRTBaseCUDA)
BOOST_FIXTURE_TEST_CASE(ipwrtbasecuda_seg, Seg)
Configure();
SetTestCase(fixt_in->GetBlocks(), fixt_in->GetStorage().GetCPUPtr());
SetTestCase(
fixtcuda_in->GetBlocks(),
fixtcuda_in->template GetStorage<MemoryRegionCUDA>().GetCPUPtr());
IProductWRTBase<>::create(fixt_explist, "StdMat")
->apply(*fixt_in, *fixt_expected);
IProductWRTBase<>::create(fixt_explist, "CUDA")
->apply(*fixtcuda_in, *fixtcuda_out);
BOOST_TEST(fixtcuda_out->compare(*fixt_expected, 1.0E-12));
boost::test_tools::output_test_stream output;
OutputIfNotMatch(
fixtcuda_out->template GetStorage<MemoryRegionCUDA>().GetCPUPtr(),
fixt_expected->GetStorage().GetCPUPtr(), 1.0E-12);
BOOST_FIXTURE_TEST_CASE(ipwrtbasecuda_quad, Quad)
Configure();
SetTestCase(fixt_in->GetBlocks(), fixt_in->GetStorage().GetCPUPtr());
SetTestCase(
fixtcuda_in->GetBlocks(),
fixtcuda_in->template GetStorage<MemoryRegionCUDA>().GetCPUPtr());
IProductWRTBase<>::create(fixt_explist, "StdMat")
->apply(*fixt_in, *fixt_expected);
IProductWRTBase<>::create(fixt_explist, "CUDA")
->apply(*fixtcuda_in, *fixtcuda_out);
BOOST_TEST(fixtcuda_out->compare(*fixt_expected, 1.0E-12));
boost::test_tools::output_test_stream output;
OutputIfNotMatch(
fixtcuda_out->template GetStorage<MemoryRegionCUDA>().GetCPUPtr(),
fixt_expected->GetStorage().GetCPUPtr(), 1.0E-12);
BOOST_FIXTURE_TEST_CASE(ipwrtbasecuda_tri, Tri)
{
Configure();
SetTestCase(fixt_in->GetBlocks(), fixt_in->GetStorage().GetCPUPtr());
SetTestCase(
fixtcuda_in->GetBlocks(),
fixtcuda_in->template GetStorage<MemoryRegionCUDA>().GetCPUPtr());
IProductWRTBase<>::create(fixt_explist, "StdMat")
->apply(*fixt_in, *fixt_expected);
IProductWRTBase<>::create(fixt_explist, "CUDA")
->apply(*fixtcuda_in, *fixtcuda_out);
BOOST_TEST(fixtcuda_out->compare(*fixt_expected, 1.0E-12));
boost::test_tools::output_test_stream output;
OutputIfNotMatch(
fixtcuda_out->template GetStorage<MemoryRegionCUDA>().GetCPUPtr(),
fixt_expected->GetStorage().GetCPUPtr(), 1.0E-12);
BOOST_FIXTURE_TEST_CASE(ipwrtbasecuda_square_all_elements, SquareAllElements)
{
Configure();
SetTestCase(fixt_in->GetBlocks(), fixt_in->GetStorage().GetCPUPtr());
SetTestCase(
fixtcuda_in->GetBlocks(),
fixtcuda_in->template GetStorage<MemoryRegionCUDA>().GetCPUPtr());
IProductWRTBase<>::create(fixt_explist, "StdMat")
->apply(*fixt_in, *fixt_expected);
IProductWRTBase<>::create(fixt_explist, "CUDA")
->apply(*fixtcuda_in, *fixtcuda_out);
BOOST_TEST(fixtcuda_out->compare(*fixt_expected, 1.0E-12));
boost::test_tools::output_test_stream output;
{
OutputIfNotMatch(
fixtcuda_out->template GetStorage<MemoryRegionCUDA>().GetCPUPtr(),
fixt_expected->GetStorage().GetCPUPtr(), 1.0E-12);
}
}
BOOST_FIXTURE_TEST_CASE(ipwrtbasecuda_hex, Hex)
{
Configure();
SetTestCase(fixt_in->GetBlocks(), fixt_in->GetStorage().GetCPUPtr());
SetTestCase(
fixtcuda_in->GetBlocks(),
fixtcuda_in->template GetStorage<MemoryRegionCUDA>().GetCPUPtr());
IProductWRTBase<>::create(fixt_explist, "StdMat")
->apply(*fixt_in, *fixt_expected);
IProductWRTBase<>::create(fixt_explist, "CUDA")
->apply(*fixtcuda_in, *fixtcuda_out);
BOOST_TEST(fixtcuda_out->compare(*fixt_expected, 1.0E-12));
boost::test_tools::output_test_stream output;
{
OutputIfNotMatch(
fixtcuda_out->template GetStorage<MemoryRegionCUDA>().GetCPUPtr(),
fixt_expected->GetStorage().GetCPUPtr(), 1.0E-12);
}
BOOST_FIXTURE_TEST_CASE(ipwrtbasecuda_prism, Prism)
{
Configure();
SetTestCase(fixt_in->GetBlocks(), fixt_in->GetStorage().GetCPUPtr());
SetTestCase(
fixtcuda_in->GetBlocks(),
fixtcuda_in->template GetStorage<MemoryRegionCUDA>().GetCPUPtr());
IProductWRTBase<>::create(fixt_explist, "StdMat")
->apply(*fixt_in, *fixt_expected);
IProductWRTBase<>::create(fixt_explist, "CUDA")
->apply(*fixtcuda_in, *fixtcuda_out);
BOOST_TEST(fixtcuda_out->compare(*fixt_expected, 1.0E-12));
boost::test_tools::output_test_stream output;
OutputIfNotMatch(
fixtcuda_out->template GetStorage<MemoryRegionCUDA>().GetCPUPtr(),
fixt_expected->GetStorage().GetCPUPtr(), 1.0E-12);
}
BOOST_FIXTURE_TEST_CASE(ipwrtbasecuda_pyr, Pyr)
{
Configure();
SetTestCase(fixt_in->GetBlocks(), fixt_in->GetStorage().GetCPUPtr());
SetTestCase(
fixtcuda_in->GetBlocks(),
fixtcuda_in->template GetStorage<MemoryRegionCUDA>().GetCPUPtr());
IProductWRTBase<>::create(fixt_explist, "StdMat")
->apply(*fixt_in, *fixt_expected);
IProductWRTBase<>::create(fixt_explist, "CUDA")
->apply(*fixtcuda_in, *fixtcuda_out);
BOOST_TEST(fixtcuda_out->compare(*fixt_expected, 1.0E-12));
boost::test_tools::output_test_stream output;
{
OutputIfNotMatch(
fixtcuda_out->template GetStorage<MemoryRegionCUDA>().GetCPUPtr(),
fixt_expected->GetStorage().GetCPUPtr(), 1.0E-12);
}
}
BOOST_FIXTURE_TEST_CASE(ipwrtbasecuda_tet, Tet)
{
Configure();
SetTestCase(fixt_in->GetBlocks(), fixt_in->GetStorage().GetCPUPtr());
SetTestCase(
fixtcuda_in->GetBlocks(),
fixtcuda_in->template GetStorage<MemoryRegionCUDA>().GetCPUPtr());
IProductWRTBase<>::create(fixt_explist, "StdMat")
->apply(*fixt_in, *fixt_expected);
IProductWRTBase<>::create(fixt_explist, "CUDA")
->apply(*fixtcuda_in, *fixtcuda_out);
BOOST_TEST(fixtcuda_out->compare(*fixt_expected, 1.0E-12));
boost::test_tools::output_test_stream output;
{
OutputIfNotMatch(
fixtcuda_out->template GetStorage<MemoryRegionCUDA>().GetCPUPtr(),
fixt_expected->GetStorage().GetCPUPtr(), 1.0E-12);
}
}
BOOST_FIXTURE_TEST_CASE(ipwrtbasecuda_cube_prism_hex, CubePrismHex)
{
Configure();
SetTestCase(fixt_in->GetBlocks(), fixt_in->GetStorage().GetCPUPtr());
SetTestCase(
fixtcuda_in->GetBlocks(),
fixtcuda_in->template GetStorage<MemoryRegionCUDA>().GetCPUPtr());
IProductWRTBase<>::create(fixt_explist, "StdMat")
->apply(*fixt_in, *fixt_expected);
IProductWRTBase<>::create(fixt_explist, "CUDA")
->apply(*fixtcuda_in, *fixtcuda_out);
BOOST_TEST(fixtcuda_out->compare(*fixt_expected, 1.0E-12));
boost::test_tools::output_test_stream output;
{
OutputIfNotMatch(
fixtcuda_out->template GetStorage<MemoryRegionCUDA>().GetCPUPtr(),
fixt_expected->GetStorage().GetCPUPtr(), 1.0E-12);
}
}
BOOST_FIXTURE_TEST_CASE(ipwrtbasecuda_cube_all_elements, CubeAllElements)
{
Configure();
SetTestCase(fixt_in->GetBlocks(), fixt_in->GetStorage().GetCPUPtr());
SetTestCase(
fixtcuda_in->GetBlocks(),
fixtcuda_in->template GetStorage<MemoryRegionCUDA>().GetCPUPtr());
IProductWRTBase<>::create(fixt_explist, "StdMat")
->apply(*fixt_in, *fixt_expected);
IProductWRTBase<>::create(fixt_explist, "CUDA")
->apply(*fixtcuda_in, *fixtcuda_out);
BOOST_TEST(fixtcuda_out->compare(*fixt_expected, 1.0E-12));
boost::test_tools::output_test_stream output;
{
OutputIfNotMatch(
fixtcuda_out->template GetStorage<MemoryRegionCUDA>().GetCPUPtr(),
fixt_expected->GetStorage().GetCPUPtr(), 1.0E-12);
}