Skip to content

Error handling

Hüseyin Tuğrul BÜYÜKIŞIK edited this page Feb 8, 2021 · 4 revisions

Currently only basic checks are included:

  • number of elements needs to be integer-multiple of page size (in elements, not bytes)

  • number of total virtual graphics card instances need to be less than or equal to number of pages

#include "GraphicsCardSupplyDepot.h"
#include "VirtualMultiArray.h"


int main(int argC, char ** argV)
{
	GraphicsCardSupplyDepot depot;

	const size_t n = 58;
	const size_t pageSize=3; // 58 = 19*pageSize + 1 !!!
        const int maxActivePagesPerGpu = 1;

	try
	{
                // deliberately chosen 60 gpu instances to raise exception (60>58/3)
                VirtualMultiArray<char> img(n,depot.requestGpus(),pageSize,maxActivePagesPerGpu,{20,20,20});

	}
	catch(std::exception & e)
	{
		std::cout<<e.what()<<std::endl;
	}
	return 0;
}