Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unit tests fail on linux #14

Open
d-meiser opened this issue Dec 4, 2014 · 3 comments
Open

unit tests fail on linux #14

d-meiser opened this issue Dec 4, 2014 · 3 comments

Comments

@d-meiser
Copy link

d-meiser commented Dec 4, 2014

Following the instructions in the readme I get the following output when running the tests:

dmeiser@longspeak:/home/scratch/hopencl (master)$ cabal test
Running 1 test suites...
Test suite unit: RUNNING...
DEBUG: Invoking clGetPlatformIDs
DEBUG: Invoking clGetPlatformIDs
DEBUG: Invoking clGetDeviceIDs
DEBUG: Invoking clGetDeviceIDs
DEBUG: Invoking clGetPlatformIDs
DEBUG: Invoking clGetDeviceIDs
DEBUG: Invoking clGetDeviceIDs
DEBUG: Invoking clCreateContext
DEBUG: Adding finalizer to Context
DEBUG: Invoking clCreateContext
DEBUG: Adding finalizer to Context
DEBUG: Invoking clGetPlatformIDs
DEBUG: Invoking clGetDeviceIDs
DEBUG: Invoking clGetDeviceIDs
DEBUG: Invoking clCreateContext
DEBUG: Adding finalizer to Context
DEBUG: Invoking clCreateContext
DEBUG: Adding finalizer to Context
DEBUG: Invoking clCreateCommandQueue
DEBUG: Adding finalizer to CommandQueue
DEBUG: Invoking clCreateCommandQueue
Test suite unit: FAIL
Test suite logged to: dist/test/hopencl-0.2.1-unit.log
0 of 1 test suites (0 of 1 test cases) passed.

I don't know much about cabal and how unit tests are typically set up in haskell. If you could give me some pointers on how to narrow this down I can try to fix.

Information about my system:

dmeiser@longspeak:/home/scratch/hopencl (master)$ uname -a
Linux longspeak.txcorp.com 2.6.32-504.1.3.el6.x86_64 #1 SMP Tue Nov 11 17:57:25 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
dmeiser@longspeak:/home/scratch/hopencl/examples/PlatformInfo (master)$ runhaskell PlatformInfo.hs 
DEBUG: Invoking clGetPlatformIDs
2 platform(s) found:
    AMD Accelerated Parallel Processing
    Advanced Micro Devices, Inc.
    OpenCL 1.2 AMD-APP (1214.3)
    FULL_PROFILE
    cl_khr_icd, cl_amd_event_callback, cl_amd_offline_devices
    NVIDIA CUDA
    NVIDIA Corporation
    OpenCL 1.1 CUDA 6.5.20
    FULL_PROFILE
    cl_khr_byte_addressable_store, cl_khr_icd, cl_khr_gl_sharing, cl_nv_compiler_options, cl_nv_device_attribute_query, cl_nv_pragma_unroll

DEBUG: Invoking clGetDeviceIDs
DEBUG: Invoking clGetDeviceIDs
2 devices(s) found:

    Device name: "Intel(R) Core(TM) i7-2720QM CPU @ 2.20GHz"
    Device type: [DeviceTypeCpu,DeviceTypeAll]
    Device vendor: "GenuineIntel"
    Device vendor id: 4098
    Device version: "OpenCL 1.2 AMD-APP (1214.3)"
    Device driver version: "1214.3 (sse2,avx)"
    Device profile: "FULL_PROFILE"
    Device available: True
    Device compiler available: True
    Device execution capabilities: [ExecKernel,ExecNativeKernel]
    Device queue properties: [QueueProfilingEnable]
    Device max clock frequency: 2195
    Device max compute units: 8
    Device max constant args: 8
    Device max parameter size: 4096
    Device max work group size: 1024
    Device max work item dimensions: 3
    Device max work item sizes: [1024,1024,1024]
    Device global mem cache type: ReadWriteCache
    Device global mem cache size: 32768
    Device global mem cache line size: 64
    Device global mem size: 8207654912
    Device local mem size: 32768
    Device local mem type: Global
    Device max mem alloc size: 2147483648
    Device max constant buffer size: 65536
    Device address bits: 64
    Device little endian: True
    Device mem base addr align: 1024
    Device min data type align size: 128
    Device preferred vector width char: 16
    Device preferred vector width short: 8
    Device preferred vector width int: 4
    Device preferred vector width long: 2
    Device preferred vector width float: 8
    Device error correction support: False
    Device profiling timer resolution: 1
    Device image support: True
    Device max read image args: 128
    Device max write image args: 8
    Device max samplers: 16
    Device image 2d max size: (8192,8192)
    Device image 3d max size: (2048,2048,2048)
    Device extensions: ["cl_khr_fp64","cl_amd_fp64","cl_khr_global_int32_base_atomics","cl_khr_global_int32_extended_atomics","cl_khr_local_int32_base_atomics","cl_khr_local_int32_extended_atomics","cl_khr_int64_base_atomics","cl_khr_int64_extended_atomics","cl_khr_3d_image_writes","cl_khr_byte_addressable_store","cl_khr_gl_sharing","cl_ext_device_fission","cl_amd_device_attribute_query","cl_amd_vec3","cl_amd_printf","cl_amd_media_ops","cl_amd_media_ops2","cl_amd_popcnt"]

    Device name: "NVS 4200M"
    Device type: [DeviceTypeGpu,DeviceTypeAll]
    Device vendor: "NVIDIA Corporation"
    Device vendor id: 4318
    Device version: "OpenCL 1.1 CUDA"
    Device driver version: "340.58"
    Device profile: "FULL_PROFILE"
    Device available: True
    Device compiler available: True
    Device execution capabilities: [ExecKernel]
    Device queue properties: [QueueOutOfOrderExecModeEnable,QueueProfilingEnable]
    Device max clock frequency: 1480
    Device max compute units: 1
    Device max constant args: 9
    Device max parameter size: 4352
    Device max work group size: 1024
    Device max work item dimensions: 3
    Device max work item sizes: [1024,1024,64]
    Device global mem cache type: ReadWriteCache
    Device global mem cache size: 16384
    Device global mem cache line size: 128
    Device global mem size: 536018944
    Device local mem size: 49151
    Device local mem type: Local
    Device max mem alloc size: 134217728
    Device max constant buffer size: 65536
    Device address bits: 32
    Device little endian: True
    Device mem base addr align: 4096
    Device min data type align size: 128
    Device preferred vector width char: 1
    Device preferred vector width short: 1
    Device preferred vector width int: 1
    Device preferred vector width long: 1
    Device preferred vector width float: 1
    Device error correction support: False
    Device profiling timer resolution: 1000
    Device image support: True
    Device max read image args: 128
    Device max write image args: 8
    Device max samplers: 16
    Device image 2d max size: (32768,32768)
    Device image 3d max size: (2048,2048,2048)
    Device extensions: ["cl_khr_byte_addressable_store","cl_khr_icd","cl_khr_gl_sharing","cl_nv_compiler_options","cl_nv_device_attribute_query","cl_nv_pragma_unroll","cl_khr_global_int32_base_atomics","cl_khr_global_int32_extended_atomics","cl_khr_local_int32_base_atomics","cl_khr_local_int32_extended_atomics","cl_khr_fp64"]

@dybber
Copy link
Member

dybber commented Dec 4, 2014

Strange that no error message is printed.

  • What happens if you run the VectorAdd example?
  • The next thing to be printed should be "DEBUG: Adding finalizer to CommandQueue"
  • The DEBUG-prints are not inserted for all operations yet (sorry about that)
  • I have not tested it on a machine with more than one platform. I'm using GHC 7.8.3 and OpenCL 1.1 on a GeForce GTX 690, but no OpenCL is installed for the CPU. Might be something there.

@d-meiser
Copy link
Author

d-meiser commented Dec 4, 2014

Here is the output from the VectorAdd example:

dmeiser@longspeak:/home/scratch/hopencl/examples/VectorAdd (master)$ runhaskell VectorAdd.hs 
DEBUG: Invoking clGetPlatformIDs
DEBUG: Invoking clGetDeviceIDs
DEBUG: Invoking clCreateContext
DEBUG: Adding finalizer to Context
DEBUG: Invoking clCreateCommandQueue
DEBUG: Adding finalizer to CommandQueue
DEBUG: Invoking clCreateProgramWithSource
DEBUG: Adding finalizer to Program
DEBUG: Invoking clBuildProgram
DEBUG: Invoking clCreateKernel
DEBUG: Adding finalizer to Kernel
DEBUG: Invoking clCreateBuffer
DEBUG: Invoking clCreateBuffer
DEBUG: Invoking clCreateBuffer
DEBUG: Invoking clSetKernelArgs
DEBUG: Invoking clSetKernelArgs
DEBUG: InvoDkEiBnUgG :c lrSeelteKaesrinnegl ACrognst
exDtE
BUDGE:B UIGn:v orkeilnega scilnEgn qPureougerNaDmR
angeKernel
DEBUG: Adding finalizer to Event
DEBUG: Invoking clEnqueueReadBuffer
DEBUG: Adding finalizer to Event
[101.0,101.0,101.0,101.0,101.0,101.0,101.0,101.0,101.0,101.0,101.0,101.0,101.0,101.0,101.0,101.0,101.0,101.0,101.0,101.0,101.0,101.0,101.0,101.0,101.0,101.0,101.0,101.0,101.0,101.0,101.0,101.0,101.0,101.0,101.0,101.0,101.0,101.0,101.0,101.0,101.0,101.0,101.0,101.0,101.0,101.0,101.0,101.0,101.0,101.0,101.0,101.0,101.0,101.0,101.0,101.0,101.0,101.0,101.0,101.0,101.0,101.0,101.0,101.0,101.0,101.0,101.0,101.0,101.0,101.0,101.0,101.0,101.0,101.0,101.0,101.0,101.0,101.0,101.0,101.0,101.0,101.0,101.0,101.0,101.0,101.0,101.0,101.0,101.0,101.0,101.0,101.0,101.0,101.0,101.0,101.0,101.0,101.0,101.0,101.0]
DEBUG: IDnEvBoUkGi:n gr eclleRaeslienags eCMoemmmOabnjdeQcute
ueD
EBUG: Invoking clReleaseMemObject
DEBUG: Invoking clReleaseMemObject
DEBUG: releasing Kernel
DEBUG: releasing Event
DEBUG: releasing Event

Looks like there is some racy printing to cout going on but other than that this seems to work fine?

Which test is being run when I do cabal test? Perhaps I can try to walk through that test in ghci to get a better idea of what is failing.

@dybber
Copy link
Member

dybber commented Dec 8, 2014

Looks like there is some racy printing to cout going on but other than that this seems to work fine?

That's because they are printed by the garbage collector, which runs concurrently, and yeah, not that useful.

Which test is being run when I do cabal test? Perhaps I can try to walk through that test in ghci to get a better idea of what is failing.

I guess the failing tests are the ones in here:
https://github.com/HIPERFIT/hopencl/blob/master/tests/unit/HOpenCL/CommandQueue_Test.hs

The idea of the tests is to test the "createCommandQueue" command and property-functions for each platform and OpenCL device.

I suspect that VectorAdd works because it just selects the first available platform and the first available device for that platform:
https://github.com/HIPERFIT/hopencl/blob/master/examples/VectorAdd/VectorAdd.hs#L16-L17

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants