﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
3350	ParModelica: parkernel and scalar output doesn't work	Gustaf Thorslund	Mahder Alemseged Gebremedhin	"{{{#!mo
setCommandLineOptions(""-v=1 +g=ParModelica +d=noevalfunc"");
loadString(""
package ParScalarOutput
  constant Integer arrayCnt = 2;
  parkernel function f
    parglobal input Real A[arrayCnt];
              output Real B;
    parglobal output Real C;
  algorithm
    if 
      oclGetGlobalId(1) == 1 and 
      oclGetGlobalId(2) == 1 and
      oclGetGlobalId(3) == 1
    then
      B := A[arrayCnt];
      C := A[1];
    end if;
  end f;
  
  function test
    input Real d;
    output Real a;
    output Real b;
  protected
    parglobal Real pResult[arrayCnt];
    Real tmp[arrayCnt];
    parglobal Real pTmp[arrayCnt];
    parglobal Real pB;
  algorithm
    for i loop
      tmp[i] := i;
    end for;
    pTmp := tmp;
    (a,pB) := f(pTmp);
    b := pB;
  end test;
end ParScalarOutput;
"");

(x,y):=ParScalarOutput.test(4);
x;
y;
}}}

{{{
- Select your device:      2
	 :Using flags -I""/home/gusth/src/OpenModelica/build/include/omc/c/""
	OpenCL initialization :        5836.392000 ms
	Kernel Execution      :        0.035000 ms
	Kernel calls: 1, time 0.000035 s, avg 0.035000 ms

6.95326731319017e-310
0.0
}}}

Tested using my ParModelicaFixes branch on github containing fixes from Mahder, so it may or may not be related to those fixes.

Workaround is to use a parglobal array as output, assign it to a parglobal array, copy to an ordinary array, and finally read the value."	defect	new	high	Future	ParModelica	trunk			
