#3347 closed defect (fixed)
ParModelica: Cannot use sqrt() or log() within parallel code due to generated OpenCL code
Reported by: | Gustaf Thorslund | Owned by: | Mahder Alemseged Gebremedhin |
---|---|---|---|
Priority: | high | Milestone: | 1.9.4 |
Component: | ParModelica | Version: | trunk |
Keywords: | Cc: |
Description
setCommandLineOptions("-v=1 +g=ParModelica +d=noevalfunc"); loadString(" package ParSqrt constant Integer arrayCnt = 2; parkernel function f parglobal input Real A[arrayCnt]; parglobal output Real B[arrayCnt]; algorithm for i in oclGetGlobalId(1):oclGetGlobalSize(1):arrayCnt loop B[i] := sqrt(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; f(pTmp); pResult := f(pTmp); result := pResult; end test; end ParSqrt; "); x:=ParSqrt.test(4);
Error building program: CL_BUILD_PROGRAM_FAILURE Build failed: Errors detected in compilation of OpenCL code: CL_PROGRAM_BUILD_LOG: :54:29: warning: incompatible pointer to integer conversion initializing 'modelica_integer' (aka 'long') with an expression of type 'char __attribute__((address_space(2))) [1]' FILE_INFO info = {"",0,0,0,0,0}; ^~ :54:32: warning: excess elements in scalar initializer FILE_INFO info = {"",0,0,0,0,0}; ^ :55:11: warning: implicit declaration of function 'omc_assert_warning' is invalid in C99 omc_assert_warning(info, "The following assertion has been violated at time %f", time); ^ :55:92: error: use of undeclared identifier 'time' omc_assert_warning(info, "The following assertion has been violated at time %f", time); ^ :56:11: warning: implicit declaration of function 'throwStreamPrintWithEquationIndexes' is invalid in C99 throwStreamPrintWithEquationIndexes(threadData, equationIndexes, "Model error: Argument of sqrt(A[i]) was %g should be >= 0", tmp1); ^ :56:59: error: use of undeclared identifier 'equationIndexes' throwStreamPrintWithEquationIndexes(threadData, equationIndexes, "Model error: Argument of sqrt(A[i]) was %g should be >= 0", tmp1);
Tested using my ParModelicaFixes branch on github with fixes from Mahder.
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 a481fe6a68354f9395f8d0e6c579079d035a0dd7/OMCompiler.
Test added in a243f9eb9b3638c7b233edbe1ad27a479af3db58/OpenModelica-testsuite