chapel-lang / chapel

a Productive Parallel Programming Language
https://chapel-lang.org
Other
1.76k stars 414 forks source link

baseAST error on calling function in sub-class #9493

Closed buddha314 closed 6 years ago

buddha314 commented 6 years ago

This project is overly-complicated at the moment. I have checked in a version that should compile with instructions on how to break it.

This is using the baseAST-error branch on Relch

It relies on several other packages, so you'll need a file called local.mk that looks something like

CHINGON_HOME=$(HOME)/git/chingon
NUMSUCH_HOME=$(HOME)/git/numsuch
CDO_HOME=$(HOME)/git/cdo
CDOEXTRAS_HOME=$(HOME)/git/cdo-extras
CHARCOAL_HOME=$(HOME)/git/Charcoal
BLAS_HOME=/usr/include/
CHREST_HOME=$(HOME)/git/chrest
RELCH_HOME=$(HOME)/git/Relch

Make sure to grab the develop branch on all of those. Once that is in place, go to the top level directory and do make test This should output something like

/home/buddha/git/chapel/third-party/re2/install/linux64-gnu-native/lib -Wl,-rpath,/home/buddha/git/chapel/third-party/re2/install/linux64-gnu-
native/lib   -o /tmp/chpl-buddha-26335.deleteme/test.tmp -L/home/buddha/git/chapel/lib/linux64/gnu/arch-native/loc-flat/comm-none/tasks-qthrea
ds/tmr-generic/unwind-none/mem-jemalloc/atomics-intrinsics/hwloc/re2/fs-none /tmp/chpl-buddha-26335.deleteme/test.tmp.o  /home/buddha/git/chap
el/lib/linux64/gnu/arch-native/loc-flat/comm-none/tasks-qthreads/tmr-generic/unwind-none/mem-jemalloc/atomics-intrinsics/hwloc/re2/fs-none/mai
n.o  -lchpl -lblas -lgmp -lm -lgmp -lchpl -lqthread -L/home/buddha/git/chapel/third-party/hwloc/install/linux64-gnu-native-flat/lib -L/home/bu
ddha/git/chapel/third-party/jemalloc/install/linux64-gnu-native/lib -ljemalloc -lhwloc -lm -lre2 -lpthread
rm -f test/test
mv /tmp/chpl-buddha-26335.deleteme/test.tmp test/test
make[1]: Leaving directory '/home/buddha/git/Relch'
 ** testing RunDefault..we have an FTP
FTP
FTP choice: 3: 0.0 choice: 0 0 1 0 0

0
we have an FTP
FTP
FTP choice: 3: 0.0 choice: 0 0 1 0 0
0
we have an FTP
FTP
FTP choice: 3: 0.0 choice: 0 0 1 0 0
0
we have an FTP
FTP
FTP choice: 3: 0.0 choice: 0 0 1 0 0
0
we have an FTP
FTP
FTP choice: 3: 0.0 choice: 0 0 1 0 0
0
we have an FTP
FTP
FTP choice: 3: 0.0 choice: 0 0 1 0 0
0
.. done (0.000419s)
 ** Passing: 0  Failing: 0

Now, to break it, you have to change the return values of each Policy in the policies.chpl file back to their actual returns. They have been tested in the testPolicies() method so I know they work. The lines are

https://github.com/Deep6AI/Relch/blob/feature/baseAST-error/src/policies.chpl#L15-L16

https://github.com/Deep6AI/Relch/blob/feature/baseAST-error/src/policies.chpl#L36-L37

https://github.com/Deep6AI/Relch/blob/feature/baseAST-error/src/policies.chpl#L82-L83

https://github.com/Deep6AI/Relch/blob/feature/baseAST-error/src/policies.chpl#L109-L110

When you return those to the actual computed value, run make test again and you should get

make test

 make test
chpl -M/home/buddha/git/chingon/src -M/home/buddha/git/cdo/src -M/home/buddha/git/numsuch/src -M/home/buddha/git/cdo-extras/src -M/home/buddha
/git/Charcoal/src -Msrc --fast --print-callstack-on-error --print-commands -I/usr/include -I/usr/include//include -I -L/usr/include//lib -lbla
s --devel -o test/test test/RelchTests.chpl ;\
./test/test ; \
rm test/test
internal error: no line number available [baseAST.cpp:316]
/bin/sh: 2: ./test/test: not found
rm: cannot remove 'test/test': No such file or directory
Makefile:21: recipe for target 'test' failed
make: *** [test] Error 1
mppf commented 6 years ago

Can you include some 'git clone' commands to set up $HOME/git with the right checked out branches? It's probably obvious to you but I don't know the source URLs for all of these git repos.

buddha314 commented 6 years ago

Good point! Sorry

git clone https://github.com/Deep6AI/Relch.git

git clone https://github.com/Deep6AI/Charcoal.git

git clone https://github.com/Deep6AI/numsuch.git

git clone https://github.com/Deep6AI/CdoExtras.git

git clone https://github.com/Deep6AI/chingon.git

git clone https://github.com/marcoscleison/chrest.git

git clone https://github.com/marcoscleison/cdo.git

Make sure to get the develop branches. And take a moment to marvel how much Chapel code is out there on the internet now!

buddha314 commented 6 years ago

This is the same project suffering from this error: https://github.com/chapel-lang/chapel/issues/9475

buddha314 commented 6 years ago

I noticed you can re-create this error by changing the return of FollowTargetPolicy policy to return [0], which supports a smell that the compiler is having a hard time identifying the return type of the variables.

mppf commented 6 years ago

I'm not seeing the internal error. I don't have BLAS installed so get an error during C compilation.

I couldn't get a develop branch for CdoExtras.

If I go into Relch and make, I get

$ make
Makefile:1: local.mk: No such file or directory
make: *** No rule to make target `local.mk'.  Stop.
mppf commented 6 years ago

Correction, I got the error reproducing, I had forgotten to make the required manual edits. (This is a lot of hoops....)

buddha314 commented 6 years ago

For CdoExtras, use master, it's very small and never called. For Relch (the one with the problem) use the baseAST-error branch.

You need to create a file called local.mk with the variables above OR just put them in your Makefile and remove the top line of the Makefile.

include local.mk   <-- remove this if need be
CC=chpl
MODULES=-M$(CHINGON_HOME)/src -M$(CDO_HOME)/src -M$(NUMSUCH_HOME)/src -M$(CDOEXTRAS_HOME)/src
INCLUDES = -I/usr/include -I$(BLAS_HOME)/include -I$(POSTGRES_HOME)
LIBS=-L$(BLAS_HOME)/lib -lblas
FLAGS=--fast --print-callstack-on-error --print-commands
SRCDIR=src
BINDIR=bin
TESTDIR=test
EXEC=relch
TEST_MODULES=-M$(CHARCOAL_HOME)/src -M$(SRCDIR)
...
buddha314 commented 6 years ago

Correction, I got the error reproducing, I had forgotten to make the required manual edits. (This is a lot of hoops....)

What can I say? We do complicated things. This project is a Reinforcement Learning project based loosely on ROS that will allow autonomous agents to learn their own policies.

mppf commented 6 years ago

@buddha314 - can you try applying the patch from PR #9495 ? It gets past the error for me, but I havn't tried to actually run the program (since I don't have BLAS installed at the moment). Can you check if it resolves the issue for you? Thanks.

buddha314 commented 6 years ago

Can you explain how to apply the patch? Sorry, it's a basic question but do I just check out a certain commit?

buddha314 commented 6 years ago

Well, because I have nerves of steel, I went into the Chapel source code and recompiled. That got me to this error

src/policies.chpl:11: error: conflicting return type specified for 'f(_mt: _MT, this: Policy, options: _array(unmanaged DefaultRectangularArr(
2,int(64),false,int(64),int(64))), state: _array(unmanaged DefaultRectangularArr(1,int(64),false,int(64),int(64)))) [4182022]: int(64)'
src/policies.chpl:96: error:   overridden by 'f(_mt: _MT, this: FollowTargetPolicy, options: _array(unmanaged DefaultRectangularArr(2,int(64),
false,int(64),int(64))), state: _array(unmanaged DefaultRectangularArr(1,int(64),false,int(64),int(64)))) [4477787]: _array(unmanaged DefaultR
ectangularArr(1,int(64),false,int(64),int(64)))'
/bin/sh: 2: ./test/test: not found
rm: cannot remove 'test/test': No such file or directory
Makefile:21: recipe for target 'test' failed
make: *** [test] Error 1

Which is actually quite useful. I'm afraid to close this ticket as it may be my last memory of @mppf but it probably deserves to be once that pull request is merged.

mppf commented 6 years ago

I'd apply it manually, since it just edits 1 line, but you can also do this:

git remote add mppf https://github.com/mppf/chapel.git
git fetch mppf
git cherry-pick 053c5163e05624935559d51c5ef57d100e713e1e
mppf commented 6 years ago

Sounds like you got it working. I'll close this along with merging that PR, when that happens.