1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
|
// Copyright 2017 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
#include "test_fixture.h"
#ifdef SYCL_LANGUAGE_VERSION
#include "sycl/sycl.hpp"
#endif
OSPRayEnvironment *ospEnv;
int main(int argc, char **argv)
{
{
// Check to make sure these functions work without a currently set device
std::cout << "Verify device API usage prior to ospInit()..." << std::endl;
auto d = ospGetCurrentDevice();
ospDeviceRetain(d);
ospDeviceRelease(d);
std::cout << "...done!" << std::endl;
}
ospInit(&argc, (const char **)argv);
::testing::InitGoogleTest(&argc, argv);
ospEnv = new OSPRayEnvironment(argc, argv);
AddGlobalTestEnvironment(ospEnv);
{
cpp::Device device = cpp::Device::current();
#ifdef SYCL_LANGUAGE_VERSION
sycl::queue *appsSyclQueue = ospEnv->GetAppsSyclQueue();
if (appsSyclQueue) {
static auto appsSyclContext = appsSyclQueue->get_context();
static auto appsSyclDevice = appsSyclQueue->get_device();
device.setParam("syclContext", OSP_VOID_PTR, (void *)&appsSyclContext);
device.setParam("syclDevice", OSP_VOID_PTR, (void *)&appsSyclDevice);
}
#endif
device.setErrorCallback(
[](void *, OSPError error, const char *errorDetails) {
std::cerr << "OSPRay error: " << errorDetails << std::endl;
std::exit(EXIT_FAILURE);
});
device.setStatusCallback([](void *, const char *msg) { std::cout << msg; });
// First commit with INFO log Level to output device info string
device.setParam("warnAsError", true);
device.setParam("logLevel", OSP_LOG_INFO);
device.commit();
// Then use WARNING log level for tests execution
device.setParam("logLevel", OSP_LOG_WARNING);
device.commit();
}
auto result = RUN_ALL_TESTS();
ospShutdown();
return result;
}
|