Opened 10 years ago

#3348 new defect

ParModelica: Unable to allocate parlocal array

Reported by: Gustaf Thorslund Owned by: Mahder Alemseged Gebremedhin
Priority: high Milestone: Future
Component: ParModelica Version: trunk
Keywords: Cc:

Description

setCommandLineOptions("-v=1 +g=ParModelica +d=noevalfunc");
loadString("
package ParLocalArray
  constant Integer arrayCnt = 2;
  parkernel function f
    parglobal input Real A[arrayCnt];
    parglobal output Real B[arrayCnt];
  protected
    parlocal Real Tmp[arrayCnt];
  algorithm
    for
      i in oclGetGlobalId(1):oclGetGlobalSize(1):arrayCnt
    loop
      Tmp[i] := A[i]*7;
      B[i] := Tmp[i]+A[i];
    end for;
  end f;
  
  function test
    input Real d;
    output Real result[arrayCnt];
  protected
    parglobal Real pResult[arrayCnt];
    Real tmp[arrayCnt];
    parglobal Real pTmp[arrayCnt];
  algorithm
    for i loop
      tmp[i] := i;
    end for;
    pTmp := tmp;
    pResult := f(pTmp);
    result := pResult;
  end test;
end ParLocalArray;
");

x:=ParLocalArray.test(4);
Error building program:
CL_BUILD_PROGRAM_FAILURE 
Build failed: Errors detected in compilation of OpenCL code:
CL_PROGRAM_BUILD_LOG:  
:33:3: error: use of undeclared identifier 'device_local_real_array'
  device_local_real_array _Tmp;
  ^
:39:3: warning: implicit declaration of function 'alloc_device_local_real_array' is invalid in C99
  alloc_device_local_real_array(&_Tmp, 1, (modelica_integer) 2);
  ^
:39:34: error: use of undeclared identifier '_Tmp'
  alloc_device_local_real_array(&_Tmp, 1, (modelica_integer) 2);
                                 ^
:52:9: error: use of undeclared identifier '_Tmp'
      (*real_array_element_addr_c99_1(&_Tmp, 1, /* modelica_integer */ (modelica_integer)_i)) = (7.0 * (*real_array_element_addr_c99_1(&_A, 1, /* modelica_integer */ (modelica_integer)_i)));
        ^
:52:40: note: instantiated from:
      (*real_array_element_addr_c99_1(&_Tmp, 1, /* modelica_integer */ (modelica_integer)_i)) = (7.0 * (*real_array_element_addr_c99_1(&_A, 1, /* modelica_integer */ (modelica_integer)_i)));
                                       ^
:54:98: error: use of undeclared identifier '_Tmp'
      (*real_array_element_addr_c99_1(&_B, 1, /* modelica_integer */ (modelica_integer)_i)) = ((*real_array_element_addr_c99_1(&_Tmp, 1, /* modelica_integer */ (modelica_integer)_i)) + (*real_array_element_addr_c99_1(&_A, 1, /* modelica_integer */ (modelica_integer)_i)));
                                                                                                 ^
:54:129: note: instantiated from:
      (*real_array_element_addr_c99_1(&_B, 1, /* modelica_integer */ (modelica_integer)_i)) = ((*real_array_element_addr_c99_1(&_Tmp, 1, /* modelica_integer */ (modelica_integer)_i)) + (*real_array_element_addr_c99_1(&_A, 1, /* modelica_integer */ (modelica_integer)_i)));

Tested using my ParModelicaFixes branch on github containing fixes from Mahder, so it may or may not be related to those fixes.

Change History (0)

Note: See TracTickets for help on using tickets.