Some time ago I wrote simple boids simulation using OpenCL (was school assignment), using C#, Cloo for OpenCL and OpenTK for OpenGL output. I tested it on Windows7 with AMD CPU implementation of OpenCL and on friend’s NVidia.
Now I tried it on Linux (Ubuntu 12.04). I installed amd app sdk and intel sdk. It compiled ok, reference CPU implementation is working fine with graphic output. But when I try to run OpenCL version, it runs for about 1 second (showing what seems like valid output in OpenGL) and then gets killed by SIGXCPU. Tried to google some known issue, but found nothing.
So I tried to catch and ignore that signal, but everytime I try, program hangs. When I set mono to catch some different signal (e.g. SIGPIPE), it runs ok (minus that kill when opencl).
In Mono, i Tried Mono.UnixSignal as stated in FAQ
Tried
Mono.Unix.Native.Stdlib.SetSignalAction ( Mono.Unix.Native.Signum.SIGXCPU, Mono.Unix.Native.SignalAction.Ignore);
then something which doesn’t hang, but doesn’t help either:
Mono.Unix.Native.Stdlib.SetSignalAction ( Mono.Unix.Native.Signum.SIGXCPU, Mono.Unix.Native.SignalAction.Error);
and even
ignore (0);
Mono.Unix.Native.Stdlib.signal(Mono.Unix.Native.Signum.SIGXCPU, new Mono.Unix.Native.SignalHandler (ignore));
with
static void ignore(int signal) {
}
even when I remove everything else from main, it still hangs sometime after “touching” that signal.
One more weird thing:
Mono.Unix.Native.Stdlib.SetSignalAction ( Mono.Unix.Native.Signum.SIGXCPU, Mono.Unix.Native.SignalAction.Default);
Kills application with SIGXCPU somewhere after Application.EnableVisualStyles(); when I set it right before, not even touching OpenCL this time.
Is there something I missed in Mono? Is it using this signal somewhere internally that it gets in the way of OpenCl?
Mono uses SIGXCPU internally for its own purposes, so if you ignore it (or it’s raised for some other reason), things will break.