#3335 closed defect (fixed)
ParModelica: parfor with for inside creates broken OpenCL code
Reported by: | Gustaf Thorslund | Owned by: | Mahder Alemseged Gebremedhin |
---|---|---|---|
Priority: | high | Milestone: | 1.9.4 |
Component: | ParModelica | Version: | trunk |
Keywords: | Cc: |
Description
Given the following test functions:
package ParArray constant Integer globalSizes = 10; constant Integer localSizes = 2; constant Integer nx = 10; constant Integer ny = 10; function OneDim input Real a; output Real result[nx]; protected parglobal Real pa; parglobal Real presult[nx]; algorithm pa := a; parfor i in 1:nx loop presult[i] := i*pa; end parfor; result := presult; end OneDim; function TwoDim1 input Real a; output Real result[nx,ny]; protected parglobal Real pa; parglobal Real presult[nx,ny]; algorithm pa := a; parfor i in 1:nx loop presult[i,1] := i*1*pa; end parfor; result := presult; end TwoDim1; function TwoDim2 input Real a; output Real result[nx,ny]; protected parglobal Real pa; parglobal Real presult[nx,ny]; algorithm pa := a; parfor i in 1:nx loop for j in 1:ny loop presult[i,j] := i*j*pa; end for; end parfor; result := presult; end TwoDim2; end ParArray;
And a little script:
setCommandLineOptions("+d=noevalfunc +g=ParModelica -v=1"); getErrorString(); setDefaultOpenCLDevice(1); getErrorString(); loadFile("ParArray.mo"); getErrorString(); // x:=ParArray.OneDim(5); getErrorString(); // y:=ParArray.TwoDim1(5); getErrorString(); z:=ParArray.TwoDim2(5); getErrorString();
The following error is produced:
$ omc ParArray.mos true "" true "" true "" "" "" :Using flags -I"/home/gusth/src/OpenModelica/build/include/omc/c/" Error building program: CL_BUILD_PROGRAM_FAILURE Build failed: Errors detected in compilation of OpenCL code: CL_PROGRAM_BUILD_LOG: /tmp/OCLdHvhO6.cl(45): error: function "omc_assert_withEquationIndexes" declared implicitly omc_assert_withEquationIndexes(threadData, info, equationIndexes, "assertion range step != 0 failed"); ^ /tmp/OCLdHvhO6.cl(45): error: identifier "threadData" is undefined omc_assert_withEquationIndexes(threadData, info, equationIndexes, "assertion range step != 0 failed"); ^ /tmp/OCLdHvhO6.cl(45): error: identifier "equationIndexes" is undefined omc_assert_withEquationIndexes(threadData, info, equationIndexes, "assertion range step != 0 failed"); ^ 3 errors detected in the compilation of "/tmp/OCLdHvhO6.cl". Internal error: clc compiler invocation failed.
OneDim and TwoDim1 works as expected, but are disabled in the above test.
Test performed on fermi with Intel driver.
Change History (4)
comment:1 by , 9 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:2 by , 9 years ago
Milestone: | Future → 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.
Note:
See TracTickets
for help on using tickets.
Fixed in e747152e2ee34c3343bc298b337106aa3d9e2595/OMCompiler.
Test added in a243f9eb9b3638c7b233edbe1ad27a479af3db58/OpenModelica-testsuite