Opened 9 years ago

Closed 9 years ago

Last modified 8 years ago

#3326 closed defect (fixed)

ParModelica: Error setting kernel arguments: CL_INVALID_ARG_SIZE

Reported by: gustaf Owned by: mahge930
Priority: blocker Milestone: 1.9.4
Component: ParModelica Version: trunk
Keywords: Cc:

Description

After applying my workaround in #3324 I try to call a small function. The test is almost same as in #3242, but here I've added a phony input argument too (see below). Now tries to run a kernel for me, but fails.

2 CL_DEVICE_NAME :		Intel(R) HD Graphics Haswell M
2 CL_DRIVER_VERSION :	0.8.0
2 CL_DEVICE_MAX_COMPUTE_UNITS :	64
2 CL_DEVICE_MAX_CLOCK_FREQUENCY :	1000
2 CL_DEVICE_LOCAL_MEM_SIZE :	                                                              64 KB
2 CL_DEVICE_GLOBAL_MEM_SIZE:                                                              128 MB
2 CL_DEVICE_MAX_MEM_ALLOC_SIZE:                                                              128 MB
2 CL_DEVICE_MAX_PARAMETER_SIZE: 1024 MB
2 CL_DEVICE_MAX_WORK_GROUP_SIZE: 512 
2 CL_DEVICE_PREFERRED_VECTOR_WIDTH_DOUBLE  : 0


- Select your device:      2
	OpenCL initialization :        1349.381000 ms
Error setting kernel arguments:
CL_INVALID_ARG_SIZE 
Error: setting argument nr:  1

Here comes the code:

package oclTest
  
  constant Integer globalSizes = 10;
  constant Integer localSizes = 2;

  parkernel function Kernel
    input Integer S;
    parglobal input Integer i[10];
    parglobal output Integer groupId[globalSizes];
    parglobal output Integer localId[globalSizes];
  protected
    Integer g;
  algorithm
    g := oclGetGlobalId(1);
    groupId[g] := oclGetGroupId(1);
    localId[g] := oclGetLocalId(1);
  end Kernel;
  
  function test
    output Integer groupId[globalSizes];
    output Integer localId[globalSizes];
  protected
    parglobal Integer p_groupId[globalSizes];
    parglobal Integer p_localId[globalSizes];
    Integer I[10];
    parglobal Integer pI[10];
  algorithm
    for i loop
      I[i] := i;
    end for;
    pI := I;
    oclSetNumThreadsGlobalLocal1D({globalSizes}, {localSizes});
      (p_groupId, p_localId) := Kernel(7,pI);
      groupId := p_groupId;
      localId := p_localId;
  end test;
end oclTest;

Together with the script used to call it:

// name: oclTest
// cflags: +g=ParModelica
// status: correct

// setGrammarParModelica();
setCommandLineOptions("+d=noevalfunc +g=ParModelica -v=1");
loadFile("oclTest.mo");
getErrorString();

(x,y):=oclTest.test();
getErrorString();

Trying a parfor gives same kernel failure. For example:

package ParForTest
  constant Integer globalSizes = 10;
  constant Integer localSizes = 2;
  constant Integer elements = 10;

  function test
    input Integer a;
    output Integer result[elements];
  protected
    Integer v[elements] = {i for i in 1:elements};
    parglobal Integer pv[elements];
    parglobal Integer pr[elements];
    parglobal Integer pa;
  algorithm
    oclSetNumThreadsGlobalLocal1D({globalSizes}, {localSizes});
    pa := a;
    pv := v;
    parfor i in 1 : elements loop
      pr[i] := pa * pv[i];
    end parfor;
    result := pr;
  end test;
end ParForTest;

Called with the script:

setCommandLineOptions("+d=noevalfunc +g=ParModelica -v=1");
getErrorString();
loadFile("parfor.mo");
getErrorString();

x:=ParForTest.test(5);
getErrorString();

Change History (6)

comment:1 Changed 9 years ago by gustaf

I've now tried this on our test machine fermi. Using the oclTest.mos above, I get the following three errors for the available three devices:

1 CL_DEVICE_NAME :		Intel(R) Xeon(R) CPU           E5520  @ 2.27GHz
1 CL_DRIVER_VERSION :	2.0
...
- Select your device:      1
	 :Using flags -I"/home/gusth/src/OpenModelica/build/include/omc/c/"
	OpenCL initialization :        19955.674000 ms
	Kernel Execution      :        0.380000 ms
Error copying device to device:
CL_MEM_COPY_OVERLAP 

""
2 CL_DEVICE_NAME :		Tesla M2050
2 CL_DRIVER_VERSION :	304.108
...
- Select your device:      2
	 :Using flags -I"/home/gusth/src/OpenModelica/build/include/omc/c/"
	OpenCL initialization :        3559.964000 ms
Error setting kernel arguments:
CL_INVALID_ARG_SIZE 
Error: setting argument nr:  1
3 CL_DEVICE_NAME :		Intel(R) Xeon(R) CPU           E5520  @ 2.27GHz
3 CL_DRIVER_VERSION :	1.2
...
- Select your device:      3
	 :Using flags -I"/home/gusth/src/OpenModelica/build/include/omc/c/"
	OpenCL initialization :        6130.132000 ms
	Kernel Execution      :        0.406000 ms
Error copying device to device:
CL_MEM_COPY_OVERLAP 

""

The parfor.mos test, does however work for the two Intel devices:

- Select your device:      3
	 :Using flags -I"/home/gusth/src/OpenModelica/build/include/omc/c/"
	OpenCL initialization :        4126.450000 ms
	Kernel Execution      :        0.198000 ms
{5,10,15,20,25,30,35,40,45,50}
""

It gives same CL_INVALID_ARG_SIZE error for the Tesla device.

comment:2 Changed 9 years ago by gustaf

Update of test script shows the test actually works on some CPU drivers for OpenCL.

Error copying device to device:
CL_MEM_COPY_OVERLAP 

""
{1,1,2,2,3,3,4,4,5,5}
{1,2,1,2,1,2,1,2,1,2}

comment:3 Changed 9 years ago by mahge930

  • Resolution set to fixed
  • Status changed from new to closed

comment:4 Changed 9 years ago by dietmarw

  • Milestone changed from Future to 1.9.4

Sorting these closed tickets away from "Future". Since they were closed after the last 1.9.3 release, it's very likely that they should have been part of the 1.9.4 release.

comment:5 Changed 8 years ago by sjoelund.se

  • Milestone changed from 1.9.4 to 1.9.4-1.9.x

Milestone renamed

comment:6 Changed 8 years ago by sjoelund.se

  • Milestone changed from 1.9.4-1.9.x to 1.9.4

Milestone renamed

Note: See TracTickets for help on using tickets.