MCPcopy Create free account
hub / github.com/clMathLibraries/clFFT / handle_exception

Function handle_exception

src/tests/test_constants.cpp:29–82  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

27#endif
28
29void handle_exception( const std::exception& except )
30{
31 std::string error_message(except.what());
32
33 std::cout << "--- Exception caught ---" << std::endl;
34
35 if( error_message.find("problem too large for device") != std::string::npos ||
36 error_message.find("CLFFT_INVALID_BUFFER_SIZE" ) != std::string::npos ||
37 error_message.find("CLFFT_MEM_OBJECT_ALLOCATION_FAILURE" ) != std::string::npos ||
38 error_message.find("CLFFT_OUT_OF_HOST_MEMORY" ) != std::string::npos ||
39 error_message.find("CLFFT_OUT_OF_RESOURCES" ) != std::string::npos )
40 {
41 std::cout << "Data set is too large for this device -- skipping test" << std::endl;
42 //TODO put in (this problem size[data + stride]/max problem size/gpu or cpu) specifics
43 }
44 else if( error_message.find("system memory allocation failure") != std::string::npos )
45 {
46 std::cout << "Framework was denied enough system memory to support the data set"
47 << " -- skipping test" << std::endl;
48 }
49 else if( error_message.find("CLFFT_DEVICE_NO_DOUBLE") != std::string::npos )
50 {
51 std::cout << "Device in context does not support double precision"
52 << " -- skipping test" << std::endl;
53 }
54 else if( error_message.find("dereference null pointer") != std::string::npos )
55 {
56 std::cout << error_message << std::endl;
57 FAIL();
58 }
59 else if( error_message.find("in-place transform, unmatched in/out layouts")
60 != std::string::npos )
61 {
62 std::cout << "Invalid arguments: for an in-place transform, "
63 << "in/output layouts must be the same" << std::endl;
64 FAIL();
65 }
66 else if( error_message.find("device list is empty at transform") != std::string::npos )
67 {
68 std::cout << "A clfft transform is requested, but the device list is empty" << std::endl;
69 FAIL();
70 }
71 else
72 {
73 std::cout << "Unrecognized exception: " << std::endl;
74 std::cout << error_message << std::endl;
75 /*
76#if defined( _WIN32 ) && defined( _DEBUG )
77 ::DebugBreak( );
78#endif
79 */
80 FAIL();
81 }
82}
83
84/*****************************************************/
85size_t max_mem_available_on_cl_device(size_t device_index) {

Callers 15

ParametersMethod · 0.85
TEST_PFunction · 0.85
TEST_FFunction · 0.85
TEST_FFunction · 0.85
TEST_PFunction · 0.85
RunTestMethod · 0.85
TEST_FFunction · 0.85
TEST_FFunction · 0.85
TEST_FFunction · 0.85
TEST_FFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected