Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- tests are optionally enabled by passing -parmodexp to runtets.pl
- Loading branch information
1 parent
11293e5
commit a243f9e
Showing
16 changed files
with
528 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
TEST = ../../../rtest -v | ||
|
||
TESTFILES = \ | ||
bug_3326.mos \ | ||
bug_3334.mos \ | ||
bug_3335.mos \ | ||
bug_3336.mos \ | ||
bug_3339.mos \ | ||
bug_3347.mos \ | ||
bug_3349.mos | ||
|
||
|
||
# test that currently fail. Move up when fixed. | ||
# Run make testfailing | ||
FAILINGTESTFILES= \ | ||
|
||
# Dependency files that are not .mo .mos or Makefile | ||
# Add them here or they will be cleaned. | ||
DEPENDENCIES = \ | ||
*.mo \ | ||
*.mos \ | ||
Makefile | ||
|
||
|
||
|
||
CLEAN = `ls | grep -w -v -f deps.tmp` | ||
|
||
.PHONY : test clean getdeps | ||
|
||
test: | ||
@echo | ||
@echo Running tests... | ||
@echo | ||
@echo OPENMODELICAHOME=" $(OPENMODELICAHOME) " | ||
@$(TEST) $(TESTFILES) | ||
|
||
# Cleans all files that are not listed as dependencies | ||
clean : | ||
@echo $(DEPENDENCIES) | sed 's/ /\\|/g' > deps.tmp | ||
@rm -f $(CLEAN) | ||
|
||
# Run this if you want to list out the files (dependencies). | ||
# do it after cleaning and updating the folder | ||
# then you can get a list of file names (which must be dependencies | ||
# since you got them from repository + your own new files) | ||
# then add them to the DEPENDENCIES. You can find the | ||
# list in deps.txt | ||
getdeps: | ||
@echo $(DEPENDENCIES) | sed 's/ /\\|/g' > deps.tmp | ||
@echo $(CLEAN) | sed -r 's/deps.txt|deps.tmp//g' | sed 's/ / \\\n/g' > deps.txt | ||
@echo Dependency list saved in deps.txt. | ||
@echo Copy the list from deps.txt and add it to the Makefile @DEPENDENCIES | ||
|
||
failingtest : | ||
@echo | ||
@echo Running failing tests... | ||
@echo | ||
@$(TEST) $(FAILINGTESTFILES) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// name: bug_3326 | ||
// status: correct | ||
|
||
// setGrammarParModelica(); | ||
setCommandLineOptions("+d=noevalfunc +g=ParModelica -v=1"); | ||
|
||
setDefaultOpenCLDevice(1); | ||
getErrorString(); | ||
|
||
loadFile("bug_3326.mo"); | ||
getErrorString(); | ||
|
||
(x,y):=oclTest.test(); | ||
getErrorString(); | ||
|
||
x; | ||
y; | ||
|
||
// Result: | ||
// true | ||
// true | ||
// "" | ||
// true | ||
// "" | ||
// | ||
// "" | ||
// {1,1,2,2,3,3,4,4,5,5} | ||
// {1,2,1,2,1,2,1,2,1,2} | ||
// endResult |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package ParFuncTest | ||
constant Integer globalSizes = 10; | ||
constant Integer localSizes = 2; | ||
constant Integer elements = 10; | ||
|
||
parallel function f | ||
parglobal input Integer i; | ||
parglobal output Integer o; | ||
algorithm | ||
o := 10*i; | ||
annotation(Inline=true); | ||
end f; | ||
|
||
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; | ||
parglobal Integer pi; | ||
algorithm | ||
oclSetNumThreadsGlobalLocal1D({globalSizes}, {localSizes}); | ||
pa := a; | ||
pv := v; | ||
parfor i in 1 : elements loop | ||
pi := i; | ||
pr[i] := pa * pv[i] * f(pi); | ||
end parfor; | ||
result := pr; | ||
end test; | ||
end ParFuncTest; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// name: bug_3334 | ||
// status: correct | ||
|
||
// setGrammarParModelica(); | ||
setCommandLineOptions("+d=noevalfunc +g=ParModelica -v=1"); | ||
|
||
setDefaultOpenCLDevice(1); | ||
getErrorString(); | ||
|
||
loadFile("bug_3334.mo"); | ||
getErrorString(); | ||
|
||
x:=ParFuncTest.test(5); | ||
getErrorString(); | ||
|
||
// x; | ||
// Result: | ||
// true | ||
// true | ||
// "" | ||
// true | ||
// "" | ||
// {50,200,450,800,1250,1800,2450,3200,4050,5000} | ||
// "" | ||
// endResult |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
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 TwoDim | ||
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 TwoDim; | ||
end ParArray; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// name: bug_3335 | ||
// status: correct | ||
|
||
// setGrammarParModelica(); | ||
setCommandLineOptions("+d=noevalfunc +g=ParModelica -v=1"); | ||
getErrorString(); | ||
|
||
setDefaultOpenCLDevice(1); | ||
getErrorString(); | ||
|
||
loadFile("bug_3335.mo"); | ||
getErrorString(); | ||
|
||
x:=ParArray.OneDim(5); | ||
getErrorString(); | ||
|
||
y:=ParArray.TwoDim(5); | ||
getErrorString(); | ||
|
||
// Result: | ||
// true | ||
// "" | ||
// true | ||
// "" | ||
// true | ||
// "" | ||
// {5.0,10.0,15.0,20.0,25.0,30.0,35.0,40.0,45.0,50.0} | ||
// "" | ||
// {{5.0,10.0,15.0,20.0,25.0,30.0,35.0,40.0,45.0,50.0},{10.0,20.0,30.0,40.0,50.0,60.0,70.0,80.0,90.0,100.0},{15.0,30.0,45.0,60.0,75.0,90.0,105.0,120.0,135.0,150.0},{20.0,40.0,60.0,80.0,100.0,120.0,140.0,160.0,180.0,200.0},{25.0,50.0,75.0,100.0,125.0,150.0,175.0,200.0,225.0,250.0},{30.0,60.0,90.0,120.0,150.0,180.0,210.0,240.0,270.0,300.0},{35.0,70.0,105.0,140.0,175.0,210.0,245.0,280.0,315.0,350.0},{40.0,80.0,120.0,160.0,200.0,240.0,280.0,320.0,360.0,400.0},{45.0,90.0,135.0,180.0,225.0,270.0,315.0,360.0,405.0,450.0},{50.0,100.0,150.0,200.0,250.0,300.0,350.0,400.0,450.0,500.0}} | ||
// "" | ||
// endResult |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
package ParArg | ||
constant Integer nx = 10; | ||
|
||
function mult | ||
input Real a; | ||
input Real m[nx]; | ||
output Real result[nx]; | ||
protected | ||
parglobal Real pa; | ||
parglobal Real pm[nx]; | ||
parglobal Real presult[nx]; | ||
algorithm | ||
pa := a; | ||
pm := m; | ||
parfor i in 1:nx loop | ||
presult[i] := pm[i]*pa; | ||
end parfor; | ||
result := presult; | ||
end mult; | ||
|
||
function multParArg | ||
input Real a; | ||
parglobal input Real mpm[nx]; | ||
parglobal output Real mpresult[nx]; | ||
protected | ||
parglobal Real pa; | ||
algorithm | ||
pa := a; | ||
parfor i in 1:nx loop | ||
mpresult[i] := mpm[i]*pa; | ||
end parfor; | ||
end multParArg; | ||
|
||
function Test | ||
input Real a; | ||
output Real result[nx]; | ||
protected | ||
Real m[nx] = {i for i in 1:nx}; | ||
Real pm[nx]; | ||
algorithm | ||
result := mult(a,m); | ||
end Test; | ||
|
||
function TestParArg | ||
input Real a; | ||
output Real result[nx]; | ||
protected | ||
Real m[nx] = {i for i in 1:nx}; | ||
parglobal Real pa; | ||
parglobal Real pm[nx]; | ||
parglobal Real presult[nx]; | ||
algorithm | ||
pa := a; | ||
pm := m; | ||
presult := multParArg(pa,pm); | ||
result := presult; | ||
end TestParArg; | ||
end ParArg; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// name: bug_3336 | ||
// status: correct | ||
|
||
// setGrammarParModelica(); | ||
setCommandLineOptions("+d=noevalfunc +g=ParModelica -v=1"); | ||
|
||
setDefaultOpenCLDevice(1); | ||
getErrorString(); | ||
|
||
loadFile("bug_3336.mo"); | ||
getErrorString(); | ||
|
||
x:=ParArg.Test(5); | ||
getErrorString(); | ||
|
||
y:=ParArg.TestParArg(5); | ||
getErrorString(); | ||
|
||
// Result: | ||
// true | ||
// true | ||
// "" | ||
// true | ||
// "" | ||
// {5.0,10.0,15.0,20.0,25.0,30.0,35.0,40.0,45.0,50.0} | ||
// "" | ||
// {5.0,10.0,15.0,20.0,25.0,30.0,35.0,40.0,45.0,50.0} | ||
// "" | ||
// endResult |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package DivTest | ||
constant Integer nx = 10; | ||
constant Integer ny = 10; | ||
|
||
function foo | ||
input Real a; | ||
output Real dst[nx,ny]; | ||
protected | ||
parglobal Real parDst[nx,ny]; | ||
parglobal Integer x; | ||
parglobal Integer y; | ||
algorithm | ||
parfor i in 1:nx*ny loop | ||
y := div((i-1), nx) + 1; | ||
x := i - (y-1) * nx; | ||
parDst[x,y] := x*y; | ||
end parfor; | ||
dst := parDst; | ||
end foo; | ||
|
||
function bar | ||
input Real a; | ||
output Real dst[nx,ny]; | ||
protected | ||
Integer i2x[nx*ny]; | ||
Integer i2y[nx*ny]; | ||
parglobal Integer pi2x[nx*ny]; | ||
parglobal Integer pi2y[nx*ny]; | ||
parglobal Real parDst[nx,ny]; | ||
parglobal Integer x; | ||
parglobal Integer y; | ||
algorithm | ||
for i in 1:nx, j in 1:ny loop | ||
i2x[i+(j-1)*nx] := i; | ||
i2y[i+(j-1)*nx] := j; | ||
end for; | ||
pi2x := i2x; | ||
pi2y := i2y; | ||
parfor i in 1:nx*ny loop | ||
y := pi2y[i]; | ||
x := pi2x[i]; | ||
parDst[x,y] := x*y; | ||
end parfor; | ||
dst := parDst; | ||
end bar; | ||
end DivTest; |
Oops, something went wrong.