How to compile the assets to the VULKAN API using Harfang's asset compiler? - compilation

Trying to compile my graphics assets using assetc.exe (running Win10 64bits). The command line seems to be valid but I only get compilation errors.
Here's the commmand line :
assetc.exe resources -api VULKAN
first I get this feedback :
Harfang ASSETC 1.1
(4589:363:518:900) > Input dir: resources
(4589:363:659:500) > Output dir: resources_compiled
(4589:364:198:900)
(4589:364:655:800) > Target platform: windows
(4589:365:188:500) > Target graphics API: VULKAN
(4589:365:712:100) > Target pipeline: forward
but then it reports a lot of errors, as if none of the assets could be compiled :
557 input files
1240 output files
0 processed
585 failed
Saving compilation DB 'resources_compiled/assetc.cab'
Compilation done, took 965ms
what am I missing, here?

The correct syntax for the API switch is either DX11, DX12, GL, GLES or VK.
What you are looking for is VK that stands for Vulkan.
So, the command line shoud read like that :
assetc resources -api VK
Let me know if this works :)

Related

Error while generating grpc files (--grpc_out: protoc-gen-grpc: Plugin failed with status code 1.)

I’m trying to run the following command to generate grpc files:
protoc --proto_path=$PROTO_PATH --plugin=protoc-gen-grpc=$PLUGIN_GRPC --grpc_out=$OUT/grpc $PROTO_FILES
This results in the following error:
/Users/MYUSERNAME/Downloads/protoc-gen-grpc-java-1.48.1-osx-aarch_64.exe: program not found or is not executable
Please specify a program using absolute path or make sure the program is available in your PATH system variable
--grpc_out: protoc-gen-grpc: Plugin failed with status code 1.
I made sure the file from the error message is located at that path and has also the correct permissions.
-rwxrwxrwx# 1 MYUSERNAME staff 6334176 10 Aug 00:03 protoc-gen-grpc-java-1.48.1-osx-aarch_64.exe
I also tried running the command as sudo.
Generating java or kotlin files with --java_out=$OUT/java --kotlin_out=$OUT/kotlin
works perfectly fine, so the problem is --grpc_out=$OUT/grpc
I also downloaded multiple versions of the protoc-gen-grpc-java-1.48.1-osx-aarch_64.exe file but it always results in the same error. I also tried replacing all path variables (e.g. $PROTO_PATH) with their corresponding values, without any effect. I’m using MacBook with M1Pro chip.
The problem is that M1 Macs aren't supported. They have copied over the osx-x86_64 binary and renamed it for osx-aarch_64 as a workaround to make it easier to run with Rosetta. See here for where that change was made and here for the full conversation about supporting M1 Macs.

Vitis PetaLinux build cant fetch required files while building an application project

I want to build a PetaLinux Image for my Ultra96v2.
I followed this guide up until building my application project in Vitis. It looks promising but then while building the application project for my custom platform, Vitis throws this error:
18:08:28 **** Incremental Build of configuration Debug for project dpu_appl_system ****
make all
Generating bif file for the system project
Executing command '::scw::generate_bif -xpfm /media/user/6b04b610-ff80-4702-a575-b0b1a78fbafb/dpu_pkg/dpu_demo/export/dpu_demo/dpu_demo.xpfm -domains linux_domain -bifpath /media/user/6b04b610-ff80-4702-a575-b0b1a78fbafb/dpu_pkg/dpu_appl_system/Debug/system.bif' on XSCT
sdcard_gen --xpfm /media/user/6b04b610-ff80-4702-a575-b0b1a78fbafb/dpu_pkg/dpu_demo/export/dpu_demo/dpu_demo.xpfm --sys_config dpu_demo --bif /media/user/6b04b610-ff80-4702-a575-b0b1a78fbafb/dpu_pkg/dpu_appl_system/Debug/system.bif --bitstream /media/user/6b04b610-ff80-4702-a575-b0b1a78fbafb/dpu_pkg/dpu_appl/_ide/bitstream/dpu_hardware.bit --sd_file /media/user/6b04b610-ff80-4702-a575-b0b1a78fbafb/dpu_pkg/dpu_appl/Debug/dpu_appl.elf
creating BOOT.BIN using /media/user/6b04b610-ff80-4702-a575-b0b1a78fbafb/dpu_pkg/dpu_appl/_ide/bitstream/dpu_hardware.bit
Running /home/user/Xilinx/Vitis/2021.2/bin/bootgen -arch zynqmp -image /media/user/6b04b610-ff80-4702-a575-b0b1a78fbafb/dpu_pkg/dpu_appl_system/Debug/sd_card_temp/boot.bif -w -o i BOOT.BIN
ERROR:BootGen - syntax error
Line #13, "/media/user/6b04b610-ff80-4702-a575-b0b1a78fbafb/dpu_pkg/dpu_appl_system/Debug/sd_card_temp/boot.bif".
... emo/sw/atf,dpu_demo/boot/bl31.elf
^
[ERROR] : BIF file parsing failed with code 1
Error writing SD card data : Error when running '/home/user/Xilinx/Vitis/2021.2/bin/bootgen -arch zynqmp -image /media/user/6b04b610-ff80-4702-a575-b0b1a78fbafb/dpu_pkg/dpu_appl_system/Debug/sd_card_temp/boot.bif -w -o i BOOT.BIN'
make: *** [makefile:42: package] Error 1
18:08:36 Build Finished (took 7s.643ms)
It specifically shows me, that there is a comma in the path where it searches for the file. The files are available
at the "normal" location, without the "atf,", "dtb,", etc
at the "weird" location. I created the path so the requested path exists for every file that throws an error message, like
/media/user/6b04b610-ff80-4702-a575-b0b1a78fbafb/dpu_pkg/dpu_appl_system/Debug/sd_card_temp/boot.bif". ... emo/sw/atf,dpu_demo/boot/bl31.elf
I created the path with the weird artefact "arf,dpu_demo", with the komma in the path, but still it wont work. Is this some kind of problem with Vitis, like some env variables not set correctly, or is the building mechanism just acting weird? I cant resolve this issue, because I am not able to change the paths it is supposed to look for the files. This hinders me in advancing my project. I work on Ubuntu 20.04.
Can anyone help me out here, please? I would really appreciate it!
I asked this question in the Xilinx Community, too, but unfortunately there was no resonance at all.
Thank you so much in advance!
PLEASE READ THE WHOLE ANSWER FOR ACTUAL SOLUTION
I think I got it now, though I did not verify whether the image actually works on my Ultra96v2, yet.
I noticed, that the weird path with commata is inside of the boot.bif and system.bif.
So the first time I tried to build it, the bif wasnt there, but got created (I assume). The bif was ready then but only had a weird path inside, so I took the makefile (you can find it in debug/sd_card), copied it, and just commented out the line GENERATE_BIF_XSCT_CMD = ${GENERATE_BIF} -xpfm ${XPFM_PATH} -domains ${DOMAINS} -bifpath ${BIF_PATH}.
Then I edited the boot.bif and system.bif and changed the atf,boot, uboot,boot, and dts,boot to just boot, so the BootGen wouldnt look into the directories with the commata anymore, but only the boot-directory which was specified.
Once that was set up, I executed the edited makefile in my console, by going into the sd_card-directory and executing the following command:
make -f <your_edited_makefile>
This means, that you cant press "build" in Vitis, it wont work. You build the content on your own and wont get a green check mark beside the project! Then the sd_card-directory was populated with (I assume) all necessary data to boot the Ultra96v2 from SD card. This was the content:
boot.scr
BOOT.BIN
dpu_appl.elf (your application project name, I guess)
README.txt
system.dtb
The underlying issue seem to have been that the ::scw::generate_bif created a path to look after, which didnt exist. Really weird issue, in my opinion.
UPDATE:
I just made some changes to the PetaLinux config with the petalinux-config command and rebuilt everything. Once I go to the Vitis part, I changed the system.bif within Vitis itself, and the project compiled successfully, also populating the sd_card directory, as it seems.
UPDATE 2:
Everything failed, so I tried to get to the *.bif of the Application System project. I opened it (linux.bif) and edited the "atf,", "dtb," and "uboot," out of it. Since this is only created once and references by the following files, this fixed my issue and the build was completed successfully in Vitis. So just ignore my originial answer and update.
I hope this is working and hope it will help some of you.

How can I specify a minimum compute capability to the mexcuda compiler to compile a mexfunction?

I have a CUDA project in a .cu file that I would like to compile to a .mex file using mexcuda. Because my code makes use of the 64-bit floating point atomic operation atomicAdd(double *, double), which is only supposed for GPU devices of compute capability 6.0 or higher, I need to specify this as a flag when I am compiling.
In my standard IDE, this works fine, but when compiling with mexcuda, this is not working as I would like. In this post on MathWorks, it was suggested to use the following command (edited from the comment by Joss Knight):
mexcuda('-v', 'mexGPUExample.cu', 'NVCCFLAGS=-gencode=arch=compute_60,code=sm_60')
but when I use this command on my file, the verbose option spits out the following line last:
Building with 'NVIDIA CUDA Compiler'.
nvcc -c --compiler-options=/Zp8,/GR,/W3,/EHs,/nologo,/MD -
gencode=arch=compute_30,code=sm_30 -gencode=arch=compute_50,code=sm_50 -
gencode=arch=compute_60,code=sm_60 -
gencode=arch=compute_70,code=\"sm_70,compute_70\"
(and so on), which signals to me that the specified flag was not passed to the nvcc properly. And indeed, compilation fails with the following error:
C:/path/mexGPUExample.cu(35): error: no instance of overloaded function "atomicAdd" matches
the argument list. Argument types are: (double *, double)
The only other post I could find on this topic was this post on SO, but it is almost three years old and seemed to me more like a workaround - one which I do not understand even after some research, otherwise I would have tried it - rather than a true solution to the problem.
Is there a setting I missed, or can this simply not be done without a workaround?
I was able to work my way around this problem after some messing around with the standard xml-files in the MatLab folder. The following steps allowed me to compile using -mexcuda:
-1) Go to the folder C:\Program Files\MATLAB\-version-\toolbox\distcomp\gpu\extern\src\mex\win64, which contains xml-files for different versions of msvcpp;
-2) Make a backup of the file that corresponds to the version you are using. In my case, I made a copy of the file nvcc_msvcpp2017 and named it nvcc_msvcpp2017_old, to always have the original.
-3) Open nvcc_msvcppYEAR with notepad, and scroll to the following block of lines:
COMPILER="nvcc"
COMPFLAGS="--compiler-options=/Zp8,/GR,/W3,/EHs,/nologo,/MD $ARCHFLAGS"
ARCHFLAGS="-gencode=arch=compute_30,code=sm_30 -gencode=arch=compute_50,code=sm_50 -gencode=arch=compute_60,code=sm_60 -gencode=arch=compute_70,code=\"sm_70,compute_70\" $NVCC_FLAGS"
COMPDEFINES="--compiler-options=/D_CRT_SECURE_NO_DEPRECATE,/D_SCL_SECURE_NO_DEPRECATE,/D_SECURE_SCL=0,$MATLABMEX"
MATLABMEX="/DMATLAB_MEX_FILE"
OPTIMFLAGS="--compiler-options=/O2,/Oy-,/DNDEBUG"
INCLUDE="-I"$MATLABROOT\extern\include" -I"$MATLABROOT\simulink\include""
DEBUGFLAGS="--compiler-options=/Z7"
-4) Remove the architectures that will not allow your code to compile, i.e. all the architecture flags below 60 in my case:
ARCHFLAGS="-gencode=arch=compute_60,code=sm_60 -gencode=arch=compute_70,code=\"sm_70,compute_70\" $NVCC_FLAGS"
-5) I was able to compile using mexcuda after this. You do not need to specify any architecture flags in the mexcuda call.
-6) (optional) I suppose you want to revert this change after you are done with the project that required you to make this change, if you want to ensure maximum portability of the code you will compile after this.
Note: you will need administrator permission to make these changes.

Trouble Creating and Executing an Intel SGX Enclave

I'm very new to SGX and wanted to start with something simple. Fortunately, I found this very basic tutorial. Unfortunately, as simple as it is, I can't get it to work. The code executes, but there are errors in the output.
[sgx_create_enclavew ..\urts\win\urts.cpp:195] Couldn't open file with CreateFile()
error 0x200f, failed to create enclave.
Buffertests:
Buffer before change: Hello World!
Buffer after change: Hello World!
Stringtests:
Returned Secret:
Saved Secret: My secret string
Load Secret:
Integertests:
secretIntValue first load: 0
saved a 1337 to the enclave.
secretIntValue second load after 1337 was saved: 0
error, failed to destroy enclave.
image of output
the tutorial says:
If you get the error SGX couldn't find the enclave file. The solution is to move the enclave_test_save.signed.dll into the same folder where the app_test_save.exe is located.
which I've tried, but it didn't solve the problem.
when I try to create the enclave using:
sgx_create_enclave(ENCLAVE_FILE, SGX_DEBUG_FLAG, &token, &updated, &eid, NULL);
it returns: SGX_ERROR_ENCLAVE_FILE_ACCESS
could the problem be a result of using a different version of Visual Studio? (The tutorial uses VS 2012, while I'm using VS 2015)
Did you run the application through command prompt or from IDE?
If you are using IDE, You need to change the debugging properties to $(OutDir) from $(ProjecttDir) under Project Properties->Configuration Properties->Debugging->Working Directory.(Both Enclave and Application) Select the Intel(R) SGX Debugger.
Disclaimer: I had the same error although under a different setting (Ubuntu, eclipse) so I am not sure to what extent this will help.
Before initialize_enclave() is called (which in turn calls sgx_create_enclave()), a chdir(absolutePath) command needs to be executed, where absolutePath needs to be the absolute path to where your executable is.
My error was due to a wrong path I used.
Thanks, I solved it. turns out I had to place enclave_test_save.signed.dll in the root folder with the .edl file and not with the .exe file.

segmentation fault when running macdeployqt

In order to run my Qt app on another Mac, I have the following two lines in my .pro file
MACDEPLOY = `echo $$QMAKE_QMAKE | sed 's/qmake/macdeployqt/g'`
QMAKE_POST_LINK = $$MACDEPLOY $$OUT_PWD/$$TARGET\.app -qmldir=$$PWD -verbose=3
This works fine for a simple HelloWorld application.
It used to work fine for my 'real' application as well but now I get the following error (my application works fine on my local Mac without these two lines)
/Users/marc/Qt5.7/5.7/clang_64/bin/macdeployqt /Users/marc/workspaceZ2/build/build-Z2Nexx40-Desktop_Qt_5_7_0_clang_64bit-Release/Z2Nexx40\.app -qmldir=/Users/marc/workspaceZ2/Z2Nexx40 -verbose=3
ERROR: Could not find bundle binary for "/Users/marc/workspaceZ2/build/build-Z2Nexx40-Desktop_Qt_5_7_0_clang_64bit-Release/Z2Nexx40.app"
ERROR: "error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/otool: can't open file: (No such file or directory)\n"
Log: Using otool:
Log: inspecting ""
ERROR: "error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/otool: can't open file: (No such file or directory)\n" make: *** [Z2Nexx40.app/Contents/MacOS/Z2Nexx40]
Segmentation fault: 11 make:
And in the problem report window that pops up I see (not sure whether I picked a relevant part of it though)
Binary Images:
0x10da98000 - 0x10dac4fff +macdeployqt (0) <46011DBB-126C-35A0-942A-ACD79B0BCC45> /Users/USER/*/macdeployqt
0x10dace000 - 0x10df2eff7 +org.qt-project.QtGui (5.7 - 5.7.0) <A41CBDE5-2955-3A57-BAE9-69001B210588> /Users/USER/*/QtGui.framework/Versions/5/QtGui
0x10e081000 - 0x10e595ff7 +org.qt-project.QtCore (5.7 - 5.7.0) <5F2F454C-CEE8-3E59-A3B7-94F51F5B9F96> /Users/USER/*/QtCore.framework/Versions/5/QtCore
0x10e6b2000 - 0x10e6b6fff com.apple.agl (3.3.1 - AGL-3.3.1) <4E401980-0F4F-33E2-A0CF-8C7CCF375F24> /System/Library/Frameworks/AGL.framework/Versions/A/AGL
0x7fff64f70000 - 0x7fff64fa7a47 dyld (360.22) <DC81CC9D-651A-3A45-8809-928282052BD3> /usr/lib/dyld
Any ideas what might be wrong here? I recently upgraded to XCode 8 (and downgraded again to 7.3), upgraded from Qt5.6 to 5.7 but I have no clue on how to proceed.
Tips on what I could try would be most helpful!
Apparently, the reason was an incorrect/incompatible plist file.
I had to add a key to the plist file and hence I had my own plist file in my code tree.
Probably after upgrading XCode, my OS or Qt, this plist file was not compatible anymore.
I removed my own plist file, rebuild, and added my key to the newly generated plist file and everything worked fine as before.

Resources