We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

Showing results for 
Search instead for 
Did you mean: 
Visitor yancoo
Registered: ‎08-17-2018

Cannot find the correct device in emulation mode using JNI

I'm trying to test examples ( https://github.com/Xilinx/Applications/tree/2017.1/GZip ), that is OK with host .exe. I need to run Java program using JNI to loadLibrary host .so,  then i make host .so by modifying utility/rules.mk, but this leads to the failure to find the correct device.


[root@localhost xil_gzip]# ls -l libxil_gzip.so 
-rwxr-xr-x. 1 root root 1646712 Aug 21 16:52 libxil_gzip.so
[root@localhost xil_gzip]# XCL_EMULATION_MODE=sw_emu java XilGzip example.txt
platform Name: Xilinx
Vendor Name : Xilinx
Found Platform
Found Device=xilinx:pcie-hw-em:7v3:1.0
XCLBIN File Name: gZip_1cu
INFO: Importing xclbin/gZip_1cu.sw_emu.xilinx_pcie-hw-em_7v3_1_0.xclbin
ERROR: xclbin/gZip_1cu.sw_emu.xilinx_pcie-hw-em_7v3_1_0.xclbin xclbin not available please build

The correct device is "xilinx:kcu1500:4ddr-xpr:4.0", but the Found Device is "xilinx:pcie-hw-em:7v3:1.0" which not exist, so error happen because the .xclbin file can not be found.

By the way, i have created emconfig.json with 'emconfigutil --platform xilinx:kcu1500:4ddr-xpr:4.0 --nd 1', and i have  writen another cpp code to call function of host .so with dlopen/dlsym, that is also OK to find the correct device, but it does not work when using JNI.

Is the emconfig.son file not processed normally in emulation mode using JNI? Any help is appreciated. thanks.


0 Kudos
3 Replies
Xilinx Employee
Xilinx Employee
Registered: ‎04-24-2013

Re: Cannot find the correct device in emulation mode using JNI

Did you choose right target device while you generate your host exe? looks like your host is try to allocate a 7v3 board but not ku1500 board. 


BTW, please use latest version of GZIP and SDAccel, 2017.1 was released over a year ago.


Visitor yancoo
Registered: ‎08-17-2018

Re: Cannot find the correct device in emulation mode using JNI

@allyzThank you for you reply. I have compared the latest version with 2017.1,and the difference between them is very small.


In order to better locate the problem, I submit the source code as attachments.


Using JNI has problems whether it is emulation mode or hardware system. We can reproduce problems as following processes.


In emulation mode:

cd xil_gzip

javac src.java/XilGzip.java -d .
javah -jni -classpath . -o src/XilGzip_JNI.h XilGzip

make all TARGETS=sw_emu DEVICES=xilinx:kcu1500:4ddr-xpr:4.0

emconfigutil --platform xilinx:kcu1500:4ddr-xpr:4.0 --nd 1

XCL_EMULATION_MODE=sw_emu java XilGzip LICENSE.txt

The error result in emulation mode:



In hw mode:

make clean
make all DEVICES=xilinx:kcu1500:4ddr-xpr:4.0

java XilGzip LICENSE.txt

The error result in hw mode:



However, using cpp code to call xil_gzip .so is all right.

g++ src.test/test_call_so.cpp -o test_call_so -ldl

# run in emulation mode
emconfigutil --platform xilinx:kcu1500:4ddr-xpr:4.0 --nd 1
XCL_EMULATION_MODE=sw_emu ./test_call_so LICENSE.txt

# run in hw mode
./test_call_so LICENSE.txt

So no matter what, using JNI to call xil_gzip .so will definitely cause problems, do you need to do something special to solve?


Best Regards.

Tags (1)
0 Kudos
Xilinx Employee
Xilinx Employee
Registered: ‎04-24-2013

Re: Cannot find the correct device in emulation mode using JNI

You mentioned cpp code works find, but I don't think Java JNI is officially supported at our flow. need follow up from Runtime team. 

0 Kudos