Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

Executable fails to exit with Mono &...

Help
Anonymous
2010-08-27
2012-12-21

  • Anonymous
    2010-08-27

    I'm having a problem on Linux where my Mono executables fail to terminate if I build an OpenCL program object with the NVIDIA driver. It just reaches the end of the executable and then hangs. I need to manually kill the process. The executable only hangs if I perform the build step of an OpenCL program object.

    Has anyone else seen this behaviour? Any idea what causes it?

    I see the same behaviour on CentOS 5.5, and Ubuntu 10.04. I've tried various versions of Mono from 1.9.1 to 2.6.7. I've tried the 195.36.24 and 256.44 NVIDIA drivers. Tested with a GTX 8800 Ultra, GTX 9800, and 280 GTX. All with the same result.

    I don't get the hang-up if I use an ATI 5870 on CentOS 5.5 with the ATI 10.8 driver and stream SDK. I also don't get the hang-up if I run in either .Net or Mono on Windows XP. I also don't get this behaviour if I just write the same program in raw C and skip Cloo entirely.

    I'll attach a minimal example that causes the problem for me. The program will output "OpenCL Test Complete" and then halt without terminating when I run it.

    namespace TestOpenCL
    {
        using System;
        using Cloo;
        
        class MainClass
        {
            private const string KernelSource = @"__kernel void rot13
        (   __global    const   char*    in                 
        ,   __global            char*    out                
        )                                                   
    {                                                       
        const uint index = get_global_id(0);                
                                                            
        out[index] = in[index];                         
    }
    ";
        
            public static void Main(string[] args)
            {
                ComputeContextPropertyList propertyList = 
                    new ComputeContextPropertyList(ComputePlatform.Platforms[0]);
                ComputeContext context;
                ComputeProgram program;
                            
                context = new ComputeContext(ComputeDeviceTypes.Gpu,
                    propertyList, null, IntPtr.Zero);
                            
                program = new ComputeProgram(context, string.Empty);
                // The program doesn't hang at the end if I remove this line.                                    
                program.Build(null, null, null, IntPtr.Zero);
                                                    
                program.Dispose();
                context.Dispose();
                
                Console.WriteLine("OpenCL Test Complete");
            }
        }
    }
    
     
  • nythrix
    nythrix
    2010-08-27

    I get InvalidValueComputeException at "program = new ComputeProgram(context, string.Empty);". Checking with http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clCreateProgramWithSource.html shows that that's more or less the expected behavior. If I replace string.Empty with the provided source the example exits normally.

    I'm testing with Vista 32bit, .NET, ATI Stream SDK 2.2, CPU device. That's my debugging capabilities ATM (my dev machine and its Nvidia card are unavailable until next week).

    Does it run pass the ComputeProgram ..ctor() on Mono?

     

  • Anonymous
    2010-09-03

    Thanks nythrix.

    I get the same behaviour wiht the NVIDIA driver whether I pass valid source or not. I just left the source code and any attempts to actually run the CL program off for brevity, since it's not necessary to reproduce the error. For example I can use this string:

    private const string KernelSource = @"__kernel void rot13
        (   __global    const   char*    in,   
            __global            char*    out
        )                                                   
    {                                                       
        const uint index = get_global_id(0);                
                                                          
        out[index] = in[index];                  
    }
    ";
    

    I still get the exact same behaviour.

    To be clear, my examples appear to run through the entire program fine with Mono. They get passed the ComputeProgram ctor, program.Build, program.Dispose, context.Dispose, and output the final message. It's just that after it finishes the process will not terminate on its own. The process just sits there doing nothing. I have to explicitly kill it.