We use ocpidev run application
because it takes out an additional step that may add confusion when first getting started.
This complicates the command you trying to run but ocpidev run application
essential sits on on top of ocpirun
command line utility. I will describe how to use it here and show running example of tutorial #1
One thing that ocpidev run application
does in the background is set OCPI_LIBRARY_PATH
environment variable correctly for you. When using ocpirun
we have to set it ourselves. OCPI_LIBRARY_PATH
does is lets OpenCPI framework know where to look for OpenCPI artifacts needed to run an OpenCPI application. Before we can use ocpirun
it is imperative to set OCPI_LIBRARY_PATH
variable correctly.
Running Tutorial 1 on Hardware
Assumptions
- OpenCPI is installed
- Tools are installed
- HDL Platform is installed
- RCC Platform is installed
- ocpiremote load
- ocpiremote start -b
Steps
- Run through Tutorial 1 (replace xsim with desired platform)
- Set OCPI_LIBRARY_PATH
- Run application using
ocpirun
ocpirun
The following commands should get it going.
cd projects/DemoProject/applications
export OCPI_LIBRARY_PATH=../artifacts:../../core/artifacts
ocpirun -v -d DemoApp.xml
What to expect:
aaron@desktop:~/opencpi-v2.4.8-rc1/projects/DemoProject/applications$ ocpirun -v -d DemoApp.xml
OCPI( 2:262.0675): When searching for PCI device '0000:29:00.0': Can't open /dev/mem, forgot to load the driver? sudo?
OCPI( 2:262.0677): In HDL Container driver, got PCI search error: Can't open /dev/mem, forgot to load the driver? sudo?
Simulation HDL device lsim:xsim for xsim (UUID b675b04c-0477-11f0-974c-573d81cec5b8, dir simulations/xsim.xsim.109252.0, ticks 200000000)
Received server information from "192.168.1.2:12345". Available containers are:
192.168.1.2:12345/PL:0 platform libresdr, model hdl, os , version , arch , build
Transports: ocpi-dma-pio,00:0a:35:00:1e:53,0,0,0x41,0x101|ocpi-socket-rdma, ,1,0,0x42,0x41|
192.168.1.2:12345/rcc0 platform xilinx24_1_aarch32, model rcc, os linux, version 24_1, arch aarch32, build
Transports: ocpi-dma-pio,00:0a:35:00:1e:53,1,0,0x103,0x103|ocpi-smb-pio,00:0a:35:00:1e:53,0,0,0xb,0xb|ocpi-socket-rdma, ,1,0,0x42,0x43|
Available containers are: 0: lsim:xsim [model: hdl os: platform: xsim], 1: 192.168.1.2:12345/PL:0 [model: hdl os: platform: libresdr], 2: 192.168.1.2:12345/rcc0 [model: rcc os: linux platform: xilinx24_1_aarch32], 3: rcc0 [model: rcc os: linux platform: ubuntu22_04]
Actual deployment is:
Instance 0 source (spec local.DemoProject.source) on rcc container 3: rcc0, using source in ../artifacts//local.DemoProject.source.rcc.0.ubuntu22_04.so dated Tue Mar 18 23:01:32 2025
Instance 1 ramp (spec local.DemoProject.ramp) on hdl container 1: 192.168.1.2:12345/PL:0, using ramp/a/ramp in ../artifacts//local.DemoProject.demo_assembly_libresdr_base.hdl.0.libresdr.bitz dated Tue Mar 18 23:05:41 2025
Instance 2 square (spec local.DemoProject.square) on hdl container 1: 192.168.1.2:12345/PL:0, using square/a/square in ../artifacts//local.DemoProject.demo_assembly_libresdr_base.hdl.0.libresdr.bitz dated Tue Mar 18 23:05:41 2025
Instance 3 ander (spec local.DemoProject.ander) on hdl container 1: 192.168.1.2:12345/PL:0, using ander/a/ander in ../artifacts//local.DemoProject.demo_assembly_libresdr_base.hdl.0.libresdr.bitz dated Tue Mar 18 23:05:41 2025
Instance 4 file_write (spec ocpi.core.file_write) on rcc container 2: 192.168.1.2:12345/rcc0, using file_write in ../../core/artifacts/ocpi.core.file_write.rcc.0.xilinx24_1_aarch32.so dated Wed Feb 12 17:55:11 2025
Application XML parsed and deployments (containers and artifacts) chosen [3 s 70 ms]
Application established: containers, workers, connections all created [0 s 472 ms]
Dump of all initial property values:
Property 0: source.value = "128" (cached)
Property 1: source.nsamples = "2000" (cached)
Property 47: file_write.fileName = "output_file.bin"
Property 48: file_write.messagesInFile = "false"
Property 49: file_write.bytesWritten = "0"
Property 50: file_write.messagesWritten = "0"
Property 51: file_write.stopOnEOF = "true"
Property 55: file_write.suppressWrites = "false"
Property 56: file_write.countData = "false"
Property 57: file_write.bytesPerSecond = "0"
Application started/running [0 s 36 ms]
Waiting for application to finish (no time limit)
Application finished [0 s 0 ms]
Dump of all final property values:
Property 0: source.value = "128" (cached)
Property 1: source.nsamples = "2000" (cached)
Property 47: file_write.fileName = "output_file.bin"
Property 48: file_write.messagesInFile = "false"
Property 49: file_write.bytesWritten = "8000"
Property 50: file_write.messagesWritten = "1"
Property 51: file_write.stopOnEOF = "true"
Property 55: file_write.suppressWrites = "false"
Property 56: file_write.countData = "false"
Property 57: file_write.bytesPerSecond = "30968980"
Notice the lines starting with âActual depoyment isâ
The following lines will indicate where the application actually ran. In the log above notice âInstance 1â you can verify it ran on the PL side of the platform in my case PL:0
is libresdr
Take a look at âInstance 4â , this is where the file_write ran. It actually ran on the ARM cpu and not on my host. This means the file was written on the platform and not my host system.
With ocpirun
I can now use the -P
argument to force it run where I want it. In this example Iâm going to force the file_write
instance to run on my host instead of the device.
aaron@desktop:~/opencpi-v2.4.8-rc1/projects/DemoProject/applications$ ocpirun -v -d -P file_write=ubuntu22_04 DemoApp.xml
OCPI( 2:547.0195): When searching for PCI device '0000:29:00.0': Can't open /dev/mem, forgot to load the driver? sudo?
OCPI( 2:547.0197): In HDL Container driver, got PCI search error: Can't open /dev/mem, forgot to load the driver? sudo?
Simulation HDL device lsim:xsim for xsim (UUID 600a7a52-0478-11f0-b7a8-5b3f4975857e, dir simulations/xsim.xsim.109403.0, ticks 200000000)
Received server information from "192.168.1.2:12345". Available containers are:
192.168.1.2:12345/PL:0 platform libresdr, model hdl, os , version , arch , build
Transports: ocpi-dma-pio,00:0a:35:00:1e:53,0,0,0x41,0x101|ocpi-socket-rdma, ,1,0,0x42,0x41|
192.168.1.2:12345/rcc0 platform xilinx24_1_aarch32, model rcc, os linux, version 24_1, arch aarch32, build
Transports: ocpi-dma-pio,00:0a:35:00:1e:53,1,0,0x103,0x103|ocpi-smb-pio,00:0a:35:00:1e:53,0,0,0xb,0xb|ocpi-socket-rdma, ,1,0,0x42,0x43|
Available containers are: 0: lsim:xsim [model: hdl os: platform: xsim], 1: 192.168.1.2:12345/PL:0 [model: hdl os: platform: libresdr], 2: 192.168.1.2:12345/rcc0 [model: rcc os: linux platform: xilinx24_1_aarch32], 3: rcc0 [model: rcc os: linux platform: ubuntu22_04]
Actual deployment is:
Instance 0 source (spec local.DemoProject.source) on rcc container 3: rcc0, using source in ../artifacts//local.DemoProject.source.rcc.0.ubuntu22_04.so dated Tue Mar 18 23:01:32 2025
Instance 1 ramp (spec local.DemoProject.ramp) on hdl container 1: 192.168.1.2:12345/PL:0, using ramp/a/ramp in ../artifacts//local.DemoProject.demo_assembly_libresdr_base.hdl.0.libresdr.bitz dated Tue Mar 18 23:05:41 2025
Instance 2 square (spec local.DemoProject.square) on hdl container 1: 192.168.1.2:12345/PL:0, using square/a/square in ../artifacts//local.DemoProject.demo_assembly_libresdr_base.hdl.0.libresdr.bitz dated Tue Mar 18 23:05:41 2025
Instance 3 ander (spec local.DemoProject.ander) on hdl container 1: 192.168.1.2:12345/PL:0, using ander/a/ander in ../artifacts//local.DemoProject.demo_assembly_libresdr_base.hdl.0.libresdr.bitz dated Tue Mar 18 23:05:41 2025
Instance 4 file_write (spec ocpi.core.file_write) on rcc container 3: rcc0, using file_write in ../../core/artifacts/ocpi.core.file_write.rcc.0.ubuntu22_04.so dated Wed Feb 12 17:44:47 2025
Application XML parsed and deployments (containers and artifacts) chosen [3 s 57 ms]
Application established: containers, workers, connections all created [0 s 98 ms]
Dump of all initial property values:
Property 0: source.value = "128" (cached)
Property 1: source.nsamples = "2000" (cached)
Property 47: file_write.fileName = "output_file.bin" (cached)
Property 48: file_write.messagesInFile = "false" (cached)
Property 49: file_write.bytesWritten = "0"
Property 50: file_write.messagesWritten = "0"
Property 51: file_write.stopOnEOF = "true" (cached)
Property 55: file_write.suppressWrites = "false"
Property 56: file_write.countData = "false"
Property 57: file_write.bytesPerSecond = "0"
Application started/running [0 s 27 ms]
Waiting for application to finish (no time limit)
Application finished [0 s 0 ms]
Dump of all final property values:
Property 0: source.value = "128" (cached)
Property 1: source.nsamples = "2000" (cached)
Property 47: file_write.fileName = "output_file.bin" (cached)
Property 48: file_write.messagesInFile = "false" (cached)
Property 49: file_write.bytesWritten = "8000"
Property 50: file_write.messagesWritten = "1"
Property 51: file_write.stopOnEOF = "true" (cached)
Property 55: file_write.suppressWrites = "false" (cached)
Property 56: file_write.countData = "false" (cached)
Property 57: file_write.bytesPerSecond = "25710245"
You can have multiple -P
arguments if needed. In my DemoProject
I only have the hdl assembly built for libresdr
if the artifacts directory contained the xsim
when running without the -P
it might choose the xsim hdl platform over the hardware platform.
Using ocpirun
in my opinion gives you a little more control, itâs still possible to do the same with ocpidev run application
using the --run-args
but this removes a layer from running.