Reputation: 43
I have some kernels working on a gpu, however I cannot assume the code will be used only on computers with a compatible gpu. I have tried to run the same kernels using a cpu device but when I try to make the context I constantly get an OutOfHostMemory error.
I have tried on the same computer that the gpu code runs on but selecting the cpu as my device, and on a computer with only onboard graphics where the only device that appears is the cpu - both give me the same error.
I have confirmed that I am able to make other calls using the device (GetDeviceInfo) and I get back what I am expecting.
What can cause this error to occur? The documentation only says 'The host is out of memory', but that doesn't help me.
Edit: feedback to comments
The code I am using is:
ErrorCode error;
Platform[] platforms = Cl.GetPlatformIDs(out error);
List<Device> devicesList = platforms.SelectMany(platform => Cl.GetDeviceIDs(platform, DeviceType.Gpu, out error)).ToList();
if (devicesList.Count == 0)
{
// no gpus detected - revert to cpus
devicesList = platforms.SelectMany(platform => Cl.GetDeviceIDs(platform, DeviceType.Cpu, out error)).ToList();
}
// select first device in list
Device device = devicesList[0];
// confirm we can talk to the device
InfoBuffer infoBuffer = Cl.GetDeviceInfo(device, DeviceInfo.Name, out error);
info = infoBuffer.ToString();
string name = infoBuffer.ToString();
// Try to create context
Context context = Cl.CreateContext(null, 1, new[] { this.Device }, this.ContextNotify, IntPtr.Zero, out error);
// this gives error: OutOfHostMemory
All previous error codes returned were success, I could see the name of the device regardless of whether or not I was using the gpu or the cpu, but I could only successfully make the context when using the gpu.
I don't think I have got far enough to hit any infinite loops yet and I haven't done anything else in opencCl prior to these calls.
Upvotes: 0
Views: 129