bu-icsg / dana

Dynamically Allocated Neural Network Accelerator for the RISC-V Rocket Microprocessor in Chisel
Other
207 stars 36 forks source link

Build Errors (riscv-tests, python 2.6?) #25

Closed zaddan closed 8 years ago

zaddan commented 8 years ago

I can successfully build riscv tool chain in isolation; however, if i try to build riscv tool chain with the instruction given in your docs, meaning: cd $ROCKETCHIP/riscv-tools git submodule update --init cd riscv-pk git apply ../../xfiles-dana/patches/riscv-pk-xfiles-syscalls.patch cd .. export RISCV= ./build.sh

_I get the following error: _ Configuring project riscv-tests configure: WARNING: using cross tools not prefixed with host triplet Building project riscv-tests /home/local/bulkhead/behzad/usr/local/rocket-chip/riscv-tools/riscv-tests/build/../isa/rv32ui/add.S:10:24: fatal error: riscv_test.h: No such file or directory compilation terminated. /home/local/bulkhead/behzad/usr/local/rocket-chip/riscv-tools/riscv-tests/build/../isa/rv32ui/simple.S:12:24: fatal error: riscv_test.h: No such file or directory /home/local/bulkhead/behzad/usr/local/rocket-chip/riscv-tools/riscv-tests/build/../isa/rv32ui/addi.S:10:24: fatal error: riscv_test.h: No such file or directory compilation terminated. compilation terminated. /home/local/bulkhead/behzad/usr/local/rocket-chip/riscv-tools/riscv-tests/build/../isa/rv32ui/amoadd_w.S:10:24: fatal error: riscv_test.h: No such file or directory compilation terminated. gmake[1]: * [rv32ui-p-simple] Error 1 gmake[1]: * Waiting for unfinished jobs.... gmake[1]: * [rv32ui-p-add] Error 1 gmake[1]: * [rv32ui-p-addi] Error 1 gmake[1]: * [rv32ui-p-amoadd_w] Error 1 /home/local/bulkhead/behzad/usr/local/rocket-chip/riscv-tools/riscv-tests/build/../isa/rv32ui/amoand_w.S:10:24: fatal error: riscv_test.h: No such file or directory compilation terminated. gmake[1]: * [rv32ui-p-amoand_w] Error 1 /home/local/bulkhead/behzad/usr/local/rocket-chip/riscv-tools/riscv-tests/build/../isa/rv32ui/amomax_w.S:10:24: fatal error: riscv_test.h: No such file or directory compilation terminated. gmake[1]: * [rv32ui-p-amomax_w] Error 1 gmake[1]: * wait: No child processes. Stop. gmake: * [isa] Error 2 gmake: * Waiting for unfinished jobs.... /home/local/bulkhead/behzad/usr/local/rocket-chip/riscv-tools/riscv-tests/build/../benchmarks/common/crt.S:3:22: fatal error: encoding.h: No such file or directory compilation terminated. gmake[1]: * [crt.o] Error 1 gmake[1]: * Waiting for unfinished jobs.... In file included from /home/local/bulkhead/behzad/usr/local/rocket-chip/riscv-tools/riscv-tests/build/../benchmarks/vvadd/vvadd_main.c:16:0: /home/local/bulkhead/behzad/usr/local/rocket-chip/riscv-tools/riscv-tests/build/../benchmarks/common/util.h:123:22: fatal error: encoding.h: No such file or directory In file included from /home/local/bulkhead/behzad/usr/local/rocket-chip/riscv-tools/riscv-tests/build/../benchmarks/rsort/rsort.c:16:0: /home/local/bulkhead/behzad/usr/local/rocket-chip/riscv-tools/riscv-tests/build/../benchmarks/common/util.h:123:22: fatal error: encoding.h: No such file or directory In file included from /home/local/bulkhead/behzad/usr/local/rocket-chip/riscv-tools/riscv-tests/build/../benchmarks/multiply/multiply_main.c:13:0: /home/local/bulkhead/behzad/usr/local/rocket-chip/riscv-tools/riscv-tests/build/../benchmarks/common/util.h:123:22: fatal error: encoding.h: No such file or directory compilation terminated. compilation terminated. compilation terminated. In file included from /home/local/bulkhead/behzad/usr/local/rocket-chip/riscv-tools/riscv-tests/build/../benchmarks/qsort/qsort_main.c:16:0: /home/local/bulkhead/behzad/usr/local/rocket-chip/riscv-tools/riscv-tests/build/../benchmarks/common/util.h:123:22: fatal error: encoding.h: No such file or directory compilation terminated. In file included from /home/local/bulkhead/behzad/usr/local/rocket-chip/riscv-tools/riscv-tests/build/../benchmarks/median/median_main.c:13:0: /home/local/bulkhead/behzad/usr/local/rocket-chip/riscv-tools/riscv-tests/build/../benchmarks/common/util.h:123:22: fatal error: encoding.h: No such file or directory compilation terminated. In file included from /home/local/bulkhead/behzad/usr/local/rocket-chip/riscv-tools/riscv-tests/build/../benchmarks/towers/towers_main.c:21:0: /home/local/bulkhead/behzad/usr/local/rocket-chip/riscv-tools/riscv-tests/build/../benchmarks/common/util.h:123:22: fatal error: encoding.h: No such file or directory compilation terminated. gmake[1]: * [multiply_main.o] Error 1 gmake[1]: * [qsort_main.o] Error 1 gmake[1]: * [rsort.o] Error 1 gmake[1]: * [vvadd_main.o] Error 1 gmake[1]: * [towers_main.o] Error 1 gmake[1]: * [median_main.o] Error 1 In file included from /home/local/bulkhead/behzad/usr/local/rocket-chip/riscv-tools/riscv-tests/build/../benchmarks/common/syscalls.c:8:0: /home/local/bulkhead/behzad/usr/local/rocket-chip/riscv-tools/riscv-tests/build/../benchmarks/common/util.h:123:22: fatal error: encoding.h: No such file or directory compilation terminated. gmake[1]: * [syscalls.o] Error 1 /home/local/bulkhead/behzad/usr/local/rocket-chip/riscv-tools/riscv-tests/build/../benchmarks/dhrystone/dhrystone.c:20:1: warning: return type defaults to 'int' [-Wimplicit-int] Proc_6 (Enum_Val_Par, Enum_Ref_Par) ^ /home/local/bulkhead/behzad/usr/local/rocket-chip/riscv-tools/riscv-tests/build/../benchmarks/dhrystone/dhrystone.c: In function 'Proc_6': /home/local/bulkhead/behzad/usr/local/rocket-chip/riscv-tools/riscv-tests/build/../benchmarks/dhrystone/dhrystone.c:29:9: warning: implicit declaration of function 'Func_3' [-Wimplicit-function-declaration] if (! Func_3 (Enum_Val_Par)) ^ /home/local/bulkhead/behzad/usr/local/rocket-chip/riscv-tools/riscv-tests/build/../benchmarks/dhrystone/dhrystone.c: At top level: /home/local/bulkhead/behzad/usr/local/rocket-chip/riscv-tools/riscv-tests/build/../benchmarks/dhrystone/dhrystone.c:54:1: warning: return type defaults to 'int' [-Wimplicit-int] Proc_7 (Int_1_Par_Val, Int_2_Par_Val, Int_Par_Ref) ^ /home/local/bulkhead/behzad/usr/local/rocket-chip/riscv-tools/riscv-tests/build/../benchmarks/dhrystone/dhrystone.c:74:1: warning: return type defaults to 'int' [-Wimplicit-int] Proc_8 (Arr_1_Par_Ref, Arr_2_Par_Ref, Int_1_Par_Val, Int_2_Par_Val) ^ In file included from /home/local/bulkhead/behzad/usr/local/rocket-chip/riscv-tools/riscv-tests/build/../benchmarks/dhrystone/dhrystone_main.c:48:0: /home/local/bulkhead/behzad/usr/local/rocket-chip/riscv-tools/riscv-tests/build/../benchmarks/common/util.h:123:22: fatal error: encoding.h: No such file or directory compilation terminated. gmake[1]: * [dhrystone_main.o] Error 1 In file included from /home/local/bulkhead/behzad/usr/local/rocket-chip/riscv-tools/riscv-tests/build/../benchmarks/mm/mm_main.c:7:0: /home/local/bulkhead/behzad/usr/local/rocket-chip/riscv-tools/riscv-tests/build/../benchmarks/common/util.h:123:22: fatal error: encoding.h: No such file or directory compilation terminated. gmake[1]: * [mm_main.o] Error 1 gmake: * [benchmarks] Error 2

seldridge commented 8 years ago

Taking a look. I remember seeing the same thing here and just verified that now. That's specific to building riscv-tests which is the last thing built by riscv-tools/build.sh. You should be able to safely ignore that and continue with the rest of the steps, unless you specifically want to use riscv-tests (we don't).

We've been a bit too aggressive in tracking upstream rocket-chip which is way out ahead of riscv-tools upstream master. This will likely be fixed with a bump to a newer version of rocket-chip. However, this shouldn't have any impact on your ability to use this repo.

zaddan commented 8 years ago

not sure what the next step should be, since ./build.sh was the last step in your doc.

On Thu, Apr 7, 2016 at 11:11 AM, Schuyler Eldridge <notifications@github.com

wrote:

Taking a look. I remember seeing the same thing here and just verified that now. That's specific to building riscv-tests which is the last thing built by riscv-tools/build.sh. You should be able to safely ignore that and continue with the rest of the steps, unless you specifically want to use riscv-tests (we don't).

We've been a bit too aggressive in tracking upstream rocket-chip which is way out ahead of riscv-tools upstream master. This will likely be fixed with a bump to a newer version of rocket-chip. However, this shouldn't have any impact on your ability to use this repo.

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/bu-icsg/xfiles-dana/issues/25#issuecomment-206974077

seldridge commented 8 years ago

Sure, apologies for the confusion. The README does need to get cleaned up. I appreciate you playing guinea pig here...

After ./build.sh finishes (or errors out on riscv-tests...), you then have a version of the toolchain that will work. You can build some test programs and sample neural networks by running:

cd $ROCKETCHIP/xfiles-dana
git submodule update --init
make

When you run make, that's doing two things:

You then need to build a C++ emulator of rocket-chip + xfiles-dana and run these programs:

cd $ROCKETCHIP/emulator
make CONFIG=XFilesDanaCppPe4Epb4Config ROCKETCHIP_ADDONS=xfiles-dana

A lot of this is described further down in the README here (https://github.com/bu-icsg/xfiles-dana#-c-chisel-backend), but the narrative is somewhat non-linear. There were a few additional minor mistakes which I've tried to clean up now.

In addition to the C++ model path, you can build a configuration for one of the supported rocket-chip FPGA targets (either a Zedboard or a zc706) and running the same thing. That is documented in rocket-chip's fpga-zynq submodule. Note, that this does require applying some patches to what Berkeley uses here. This documentation is currently missing from the README.

zaddan commented 8 years ago

thanks for your quick response. When I run make, I get the following error.

[INFO] Using seed 0 Traceback (most recent call last): File "./usr/bin/gen-math-data", line 124, in main() File "./usr/bin/gen-math-data", line 68, in main y = numpy.vectorize(eval('math.{0}'.format(args.function)))(x_scaling * x) File "/usr/lib64/python2.6/site-packages/numpy/lib/function_base.py", line 1762, in init nin, ndefault = _get_nargs(pyfunc) File "/usr/lib64/python2.6/site-packages/numpy/lib/function_base.py", line 1694, in _get_nargs raise ValueError, 'failed to determine the number of arguments for %s' % (obj) ValueError: failed to determine the number of arguments for <built-in function sin> make: *\ [build/nets/sin-scale-0.25-float.train] Error 1

should i ignore it?

On Thu, Apr 7, 2016 at 11:46 AM, Schuyler Eldridge <notifications@github.com

wrote:

Sure, apologies for the confusion. The README does need to get cleaned up. I appreciate you playing guinea pig here...

After ./build.sh finishes (or errors out on riscv-tests...), you then have a version of the toolchain that will work. You can build some test programs and sample neural networks by running:

cd $ROCKETCHIP/xfiles-dana git submodule update --init make

When you run make, that's doing two things:

  • make newlib -- builds some software libraries and test programs using the newlib toolchain. Note: the newlib toolchain doesn't support building the testing infrastructure shipped with the newest version of FANN. You will see some errors fly by during this build process, but the Makefile target for this will purposefully suppress them from causing the build to fail.
  • make nets -- builds neural network configurations and training files suitable for running on xfiles-dana. This process is relatively involved, but is documented here: https://github.com/bu-icsg/xfiles-dana/blob/master/doc/toolflow.md

You then need to build a C++ emulator of rocket-chip + xfiles-dana and run these programs:

cd $ROCKETCHIP/emulator make CONFIG=XFilesDanaCppPe4Epb4Config ROCKETCHIP_ADDONS=xfiles-dana

A lot of this is described further down in the README here ( https://github.com/bu-icsg/xfiles-dana#-c-chisel-backend), but the narrative is somewhat non-linear. There were a few additional minor mistakes which I've tried to clean up now.

In addition to the C++ model path, you can build a configuration for one of the supported rocket-chip FPGA targets (either a Zedboard or a zc706) and running the same thing. That is documented in rocket-chip's fpga-zynq submodule. Note, that this does require applying some patches to what Berkeley uses here. This documentation is currently missing from the README.

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/bu-icsg/xfiles-dana/issues/25#issuecomment-206988112

seldridge commented 8 years ago

That's failing on generating data for one of the example neural networks that tries to approximate a sine function. This is known to work fine with python 3.5 and python 2.7, but it may be a problem with python 2.6. I do not have a machine where I'm able to test this locally. If you have python 2.7 or 3, I'd try it with that.

Alternatively, you may be missing numpy/scipy (though from your log, this doesn't appear to be the case).

You can get everything you need to run the testcases shown in the README with the following commands:

make newlib
make build/nets/xorSigmoidSymmetric-fixed.train build/nets/xorSigmoidSymmetric-fixed.16bin

I can try and relax the constraints by not building these networks by default. No specific timeframe on this part, however. Let me know if you have some updates about python 2.7/3. I'll re-open this generally as a general "build problems" issue.

Thanks again for running through this and for the feedback.

zaddan commented 8 years ago

I believe, I pass that point now that I am using python 2.7. however, now I get the following error: riscv64-unknown-elf-gcc -Wall -Werror -march=RV64IMAFDXcustom -I. -c ./src/main/c/xfiles-user.c -o build/newlib/xfiles-user.o /bin/bash: riscv64-unknown-elf-gcc: command not found make: *\ [build/newlib/xfiles-user.o] Error 127

On Thu, Apr 7, 2016 at 1:01 PM, Schuyler Eldridge notifications@github.com wrote:

Reopened #25 https://github.com/bu-icsg/xfiles-dana/issues/25.

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/bu-icsg/xfiles-dana/issues/25#event-618896471

handong32 commented 8 years ago

The error is saying riscv64-unknown-elf-gcc not found, were you able to build the riscv-toolchain? You can get it here: https://github.com/riscv/riscv-tools

seldridge commented 8 years ago

Make sure that you have the $RISCV/bin directory on your PATH, i.e., make sure that the RISCV environment variable is properly defined and that the following is included in your .bashrc:

export PATH=$PATH:$RISCV/bin

You should already have the toolchain built, but this won't be on your PATH unless you explicitly add it. This is described in the risc-tools documentation, but should probably be added to our README as well.

On Thu, Apr 7, 2016, 18:47 Han Dong notifications@github.com wrote:

The error is saying riscv64-unknown-elf-gcc not found, were you able to build the riscv-toolchain? You can get it here: https://github.com/riscv/riscv-tools

— You are receiving this because you modified the open/close state. Reply to this email directly or view it on GitHub https://github.com/bu-icsg/xfiles-dana/issues/25#issuecomment-207124219

seldridge commented 8 years ago

If you're still having issues, let us know. Closing for now.