Tensorflow Lite and edgetpu_compiler: Compiling for version 10 gives "Internal compiler error. Aborting!" - tensorflow

I am attempting to compile the code at this Coral example on Colab to run on runtime version 10, since I have a Coral USB Accelerator connected to a customized build for Raspberry Pi Zero W.
The command I'd like to get working is
edgetpu_compiler --min_runtime_version 10 [.TFLITE file]
It always ends with an internal error; unknown to me why that would be...? The error is:
Edge TPU Compiler version 2.1.302470888
Internal compiler error. Aborting!
To reproduce this, you should do the import, preparation, build, and first training steps. No need to fine-tune: results are the same.
I understand that certain operations are not available for lower runtimes, but I am at a loss at what exactly would need to change in the demo so as to compile it successfully.
Does anyone know what might be missing, or otherwise provide guidance?

just got a chance to check this out, looks like there is actually a bug preventing compilation at older runtime version...
This is fixed as I'm able to compile this model with -m 10 form the code base, it'll be fixed for you by next release. For now here is a work around (essentially checking out an older compiler version to compile the model):
$ git clone https://github.com/google-coral/edgetpu.git && cd edgetpu
$ git checkout 657d2b6
$ ./compiler/x86_64/edgetpu_compiler -s -m 10 /path/to/model
This should works, although with an older runtime, many ops weren't supported then so you may not see the performance increase that you would with the current runtime version!

Related

Cannot compile PDDL 2.1 Temporal Planner POPF on Ubuntu 20.04.1 LTS

I need a temporal planner that supports durative-actions in PDDL, I was following this youtube guide, but I can't make the popf planner work.
I'm getting this error when making popf:
/home/virginia/Scaricati/popf/src/VALfiles/TimSupport.cpp:1392:36: required from here
/usr/include/c++/9/bits/stl_tree.h:1117:16: error: no type named ‘value_type’ in ‘struct std::iterator_traits<TIM::getConditionally<std::_Rb_tree_const_iterator<TIM::Property*> > >’
1117 | __enable_if_t<!__same_value_type<_InputIterator>::value>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
make[2]: *** [src/VALfiles/CMakeFiles/Inst.dir/build.make:154: src/VALfiles/CMakeFiles/Inst.dir/TimSupport.o] Errore 1
make[1]: *** [CMakeFiles/Makefile2:213: src/VALfiles/CMakeFiles/Inst.dir/all] Errore 2
I used these commands:
mkdir build
cd build
cmake path_to_src_folder
make
After the installation process I expected to have the file 'build/popf/popf-clp' as a binary of popf.
Obviously, since I have an error, I don't have it.
I am using Ubuntu 20.04.1 LTS.
I think this is related to the fact that the VAL code is quite old and incompatible with the newer C++ libraries. Try putting it inside a Singularity file (very similar to Docker, but for some performance reasons AI Planning community prefers Singularity) which uses Ubuntu 16.04 as its base image. Then change your planner invocation scripts to run the singularity image instead (which you could then set in VSCode).
Refer to this very similar issue (SMTPlan and POPF use the same VAL code which is giving you problems):
https://github.com/KCL-Planning/SMTPlan/issues/10#issuecomment-660515454
Further down there is a reference to the Singularity file I had used, but you would need to change it to include your POPF compilation steps instead of SMTPlan.
I think I had the exact same error. And finally, I tried this fork version that compiled on "first try" on my Ubuntu 22.04 (after apt installed dependancies)
https://github.com/DaniGarciaLopez/popf

Is there an updated disk image binary for the x86 architecture for running gem5 in full system mode?

I am currently using the linux-x86.img which I downloaded from the documentation page for gem5 (http://www.m5sim.org/Download), but since I was not able to compile the fscanf and fopen commands on this image I was wondering if there is a more recent image which I could download and use instead.
The error message throw when trying to compile the lines with fopen and fscanf are
./obj/edgelist.o: In function loadEdgeArray': edgelist.c:(.text+0x148): undefined reference to __isoc99_fscanf'
./obj/edgelist.o: In function loadEdgeArrayInfo': edgelist.c:(.text+0x20c): undefined reference to __isoc99_fscanf'
collect2: ld returned 1 exit status
make: *** [test] Error 1
This error is thrown when trying to compile from both from qemu as well as gem5.
Here's one setup that generates such an image with Buildroot. I'm a fan of Buildroot because it builds everything from source. I don't understand how fscanf and fopen could fail in that image, but I have tested them in the above setup and they work fine.
Boot used to work in the past, but gem5 X86 full system boot has been broken for likely easy to fix reasons for a few months now as of March 2020 on the gem5 side, although there are efforts in place to fix it, and so likely it will work again soon: https://www.gem5.org/project/2020/03/09/boot-tests.html
Other alternatives include:
https://gem5art.readthedocs.io/en/latest/ which Jason has been pushing and uses Packer to generate disk images
You can also extract working disk images from Docker: https://hub.docker.com/_/ubuntu This requires exporting them to a file to give to gem5.
It is also worth noting that when the gem5.org website migrated from the old Wiki to the new static website setup in Q1 2020, we lost the ability of doing directory listing under http://dist.gem5.org/dist/current/arm/ for some reason, and so devs were forced to list them one by one on the static website... https://www.gem5.org/documentation/general_docs/fullsystem/guest_binaries
I am not sure why the error is no longer occurring for me, but documenting the steps I went through which might have fixed something. I reinstalled Ubuntu18.04 therefore had to rebuild gem5 and I used the parsec image (http://www.cs.utexas.edu/~parsec_m5/x86root-parsec.img.bz2) referenced in this answer Booting gem5 X86 Ubuntu Full System Simulation

nv-nsight-cu-cli caused Tensorflow to fail

I've downloaded the newest Nsight Compute profiling tool and I want to use it to benchmark Tensorflow applications. The code I'm using is here. It runs perfectly fine when I execute it and when I benchmark it with nvprof ./mnist.py it had no problem at all. However, when I try to run it with command sudo ./nv-nsight-cu-cli [path to the file] I get the following error:
ImportError: libcublas.so.9.0: cannot open shared object file: No such file or directory
I suspect that nv-nsight-cu-cli somehow didn't recognized the environment variable at all. Is there any fix around?
You need to search for differences in both environments:
env variables
LD_LIBRARY_PATH
/etc/ld.so.conf
/etc/ld.so.conf.d/*
cuBLAS
Is installation complete/not broken?
Is it installed at the same location on both machines?
Versions
...
You can start with locate libcublas.so on both machines to see if there's a difference. Alternatively, you can strace -f -e open the program to check where it tries to libcublas.so from.
Your error has (for now) nothing to do with GPUs: libcublas.so.9.0 can just not be found. Find it, find why Tensorflow can not find it and your problem will be solved.
It appears that GP100 is not supported by the tool at this moment.
The answer is found here:
Nsight Compute only supports Pascal (other than GP100) and later GPUs.

caffe.set_mode_cpu() error in Caffe

I have built caffe with only cpu support. Is the command 'caffe.set_mode_cpu() ' only used when we have built with gpu support so that we can switch to cpu when needed? I thought I might need it just to make sure that Caffe is using my cpu but I guess the build takes care of that. Also is this command required even when I have built with cpu support only?
Error I get-
WARNING: Logging before InitGoogleLogging() is written to STDERR
E1220 14:26:00.833413 17923 common.cpp:117] Cannot create Cublas handle. Cublas won't be available.
E1220 14:26:00.833684 17923 common.cpp:124] Cannot create Curand generator. Curand won't be available.
E1220 14:26:00.833871 17923 common.cpp:128] Cannot create cuDNN handle. cuDNN won't be available.
F1220 14:26:00.834089 17923 _caffe.cpp:61] Check failed: error == cudaSuccess (35 vs. 0) CUDA driver version is insufficient for CUDA runtime version
*** Check failure stack trace: ***
Aborted (core dumped)
Problem posted on caffe users group
This is my output of 'ccmake ..' . It says that CPU_ONLY is off even after removing the comment on CPU flag. How do I make it build with CPU for sure?
To build Caffe, I used cmake .. instead of make as I got convert_imageset.bin error. So I followed the instructions in the link and I got it to build properly.
Now I was looking at my cmake output and realised that the "CPU_ONLY" option was set to off. So i followed this link where i used "cmake -DCPU_ONLY=ON" to set it ON.
But I'm still getting Cuda error even when cmake option "CPU_ONLY=ON" is there. I am not sure why it is still being built with GPU?
Looking at my cmake output again, I found this error-
CMake Error at CMakeLists.txt:85 (add_dependencies): The dependency target "pycaffe" of target "pytest does not exist.
Is this fine since anyways we have to do make pycaffe to build with python?

Using bitbake to build a custom gumstix kernel

I've a gumstix Overo which I am configuring to work with a e-CAM camera. The documentation provided by camera manufacture asks me to patch a 2.6.34 kernel and compile in Video For Linux support. When I look at gumstix user documentation they say I should execute:
bitbake -c menuconfig virtual/linux
However when I run this command I get
bacon:~/proj/overo-oe$ bitbake -c menuconfig virtual/linux
NOTE: Handling BitBake files: \ (7100/7100) [100 %]
NOTE: Parsing finished. 6382 cached, 413 parsed, 305 skipped, 2 masked.
ERROR: Nothing PROVIDES 'virtual/linux'
I'm not altogether sure about how I provide virtual/linux. Any ideas about how to fix this error?
This might be a case of out-of-date documentation. In any case, my current work around is to name the kernel explicitly: bitbake -c menuconfig linux-omap3-2.6.34
I can help with a step-by-step procedure to bitbake 3.0 kernel.
If that may be helpful for you. Using a WMware Ubuntu ...
I would stay away from convoluted build systems as bitbake. Every one seems to be inventing one... making the 'tool' to get more of your time then the thing you want to do with the tool. All of them are the same. Linus would quote on those guys:
Just don't do it...!