Anteckning
Åtkomst till den här sidan kräver auktorisering. Du kan prova att logga in eller ändra kataloger.
Åtkomst till den här sidan kräver auktorisering. Du kan prova att ändra kataloger.
This blog post assumes you have read the introduction to C++ AMP exceptions.
An instance of the out_of_memory exception type is thrown when an underlying OS/DirectX API call fails due to failure to allocate system or device memory. Operations like parallel_for_each execution, copying data, accelerator.wait , Stage buffer creations, Data buffer creations etc. involve calling underlying OS/DirectX APIs.
Scenario |
Exception Message |
Code Snippet |
Stage buffer creation between two accelerators. |
Failed to create staging buffer |
/* The below code creates large stagingbuffer of size 1024 * 1024 * 512 (2GB) between cpu accelerator and default accelerator.out_of_memory exception is thrown based on the availability of memory */ try { concurrency::extent<1> ext(1024 * 1024 * 512); accelerator gpu; accelerator cpu(accelerator::cpu_accelerator); array<int, 1> src(ext,cpu.default_view,gpu.default_view); } catch(out_of_memory& ex) { std::cout<< ex.what() << std::endl; } |
My next blog post covers accelerator_view_removed exception, the last one of C++ AMP Exceptions.