Intel oneAPI dpcpp compiler with google test - intel

I'm kinda new to the world of Intel's HPC toolchain and I'm facing some troubles making even simple DPC++ application to work when gtest is used as a testing framework
This is the CMakeLists "structure" I'm following
cmake_minimum_required(VERSION 3.14)
project(foo)
set(CMAKE_CXX_COMPILER "dpcpp")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -O3 -fsycl")
# add executables
# target linked libraries
# ...
option(ENABLE_TESTS ON)
if(ENABLE_TESTS)
FetchContent_Declare(
googletest
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG release-1.11.0
)
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
FetchContent_MakeAvailable(googletest)
add_subdirectory(tests)
endif()
If I remove the last block, it compiles and runs as expected, otherwise I get the following error:
CMake Error at build/_deps/googletest-src/CMakeLists.txt:10 (project):
The CMAKE_CXX_COMPILER:
dpcpp
is not a full path and was not found in the PATH.
Tell CMake where to find the compiler by setting either the environment
variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path
to the compiler, or to the compiler name if it is in the PATH.
-- Configuring incomplete, errors occurred!
See also "/home/u141905/foo/build/CMakeFiles/CMakeOutput.log".
See also "/home/u141905/foo/build/CMakeFiles/CMakeError.log".
You have changed variables that require your cache to be deleted.
Configure will be re-run and you may have to reset some variables.
The following variables have changed:
CMAKE_CXX_COMPILER= /usr/bin/c++
-- Generating done
CMake Generate step failed. Build files cannot be regenerated correctly.
make: *** [Makefile:2: all] Error 1
Please notice that dpcpp is correctly set, in fact I'm using Intel's devcloud platform.
Setting CXXto the output of whereis dpcpp produces the same error.
The only "workaround" (I doubt it is one though) I found is using clang++ instead (the version from Intel's llvm). Any help or suggestion is much appreciated, thanks in advance!
EDIT: after some more attempts, I noticed that if I set CMAKE_CXX_COMPILER just after fetching gtest, everything works fine. Anyway I don't understand why this happens and how can be properly fixed.

Use the path for dpcpp binary for setting the CMAKE_CXX_COMPILER instead of using"set(CMAKE_CXX_COMPILER "dpcpp")". After adding the path("/opt/intel/oneapi/compiler/2022.0.1/linux/bin/dpcpp") to the CMAKE_CXX_COMPILER, you can run the program successfully.
Please find the below CMakeLists.txt for setting the CMAKE_CXX_COMPILER:
project(foo)
set(CMAKE_CXX_COMPILER "/opt/intel/oneapi/compiler/2022.0.1/linux/bin/dpcpp")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -O3 -fsycl")
# add executables
# target linked libraries
# ...
set(ENABLE_TESTS ON)
include(FetchContent)
if(ENABLE_TESTS)
FetchContent_Declare(
googletest
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG release-1.11.0
)
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
FetchContent_MakeAvailable(googletest)
add_subdirectory(tests)
endif()
Thanks & Regards,
Hemanth

Did you run the source /opt/intel/oneapi/setvars.sh intel64 script? I.e. is dpcpp on your path before running cmake?

Related

Fail to link to standard library of Ocaml-java (or Cafesterol)

I am a new user of Ocaml-java (or Cafesterol) which compiles primtive Ocaml program to executable jar that is allowed run on JVM. However when I try to compile a test program into executable jar I got error info as follow:
>java -jar ~/ocaml-project/ocamljava-bin-1.4/bin/ocamljava.jar -standalone regexdna.ml -o regexdna.jar
File "regexdna.ml", line 1, characters 0-1:
Error: No implementations provided for the following modules:
Str referenced from regexdna.cmj
Unix referenced from regexdna.cmj
It seems module Str and Unix is missing from Ocaml-java. However, str.jar and unix.jar do exist under ~/ocaml-project/ocamljava-bin-1.4/lib/others/ when I install Ocaml-java, and within these jars we do have Str.class and Unix.class. (I suppose this directory is on the path of the standard library of Ocaml-java, so it should be included in default search path)
Can any Ocaml-java user tell me how Ocaml-java search for dependency libraries?
Quoting Xavier Clerc on this :
Well it should work, but you have to pass explicitly the referenced
library (just as in vanilla OCaml). Leading in your case to:
$ /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java -jar ~/opt/ocamljava-2.0-early-access9/lib/ocamljava.jar str.cmja regexdna.ml
Note that I am using the latest ocamljava preview.

QtCreator 2.7 does not load debug symbols and it skips breakpoints

I'm trying for 3-4 days to set up my debugger in Qt without success.
I have Qt creator 2.7.0 with compiler MINGW and debugger gdb.exe on Windows 7
I'm building on debug mode, the debugger is skipping the breakpoints.
Thank you in advance for any tip
![qt setup][1]
This is how debugger output looks like:
sSetting breakpoints...
dSetting breakpoints...
dATTEMPT BREAKPOINT SYNCHRONIZATION
dTAKING OWNERSHIP OF BREAKPOINT 1 IN STATE 0
<53-break-insert -f "\"onmainwindow.cpp\":333"
dBREAKPOINTS ARE NOT FULLY SYNCHRONIZED
dATTEMPT SYNC
dATTEMPT BREAKPOINT SYNCHRONIZATION
dBREAKPOINTS ARE NOT FULLY SYNCHRONIZED
>&"No source file named onmainwindow.cpp in loaded symbols.\n"
>53^done,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="<PENDING>",pending="\"onmainwindow.cpp\":333",times="0"}
<54-break-delete 1
>54^done
<55-break-insert -f "\"onmainwindow.cpp\":333"
>&"No source file named onmainwindow.cpp in loaded symbols.\n"
>55^done,bkpt={number="2",type="breakpoint",disp="keep",enabled="y",addr="<PENDING>",pending="\"onmainwindow.cpp\":333",times="0"}
dATTEMPT BREAKPOINT SYNCHRONIZATION
dBREAKPOINTS ARE SYNCHRONIZED
dALL COMMANDS DONE; INVOKING CALLBACK
<56maint print msymbols C:/Users/Lucian/AppData/Local/Temp/gdb_ns_.Ae4844
>&"maint print msymbols C:/Users/Lucian/AppData/Local/Temp/gdb_ns_.Ae4844\n"
>56^done
dFOUND NON-NAMESPACED Qt
dNOTE: INFERIOR SETUP OK
dState changed from InferiorSetupRequested(4) to InferiorSetupOk(6) [master]
dState changed from InferiorSetupOk(6) to EngineRunRequested(7) [master]
dQUEUE: RUN ENGINE
dCALL: RUN ENGINE
<57-exec-run
>57^running
dNOTE: ENGINE RUN AND INFERIOR RUN OK
sRunning.
dState changed from EngineRunRequested(7) to InferiorRunOk(11) [master]
dINFERIOR STARTED
sApplication started
>~"[New thread 7144.0x1fdc]\n"
dFOUND PID 7144
dTaking notice of pid 7144
s[New thread 7144.0x1fdc]
>~"(no debugging symbols found)\n"
>~"(no debugging symbols found)\n"
>~"(no debugging symbols found)\n"
I installed also the new gdb debugger and it also doens;t stop ar breakpoints, this new gdb version outputs:
dATTEMPT SYNC
dATTEMPT BREAKPOINT SYNCHRONIZATION
dBREAKPOINTS ARE NOT FULLY SYNCHRONIZED
>&"No symbol table is loaded. Use the \"file\" command.\n"
>200^done,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="`<PENDING>",pending="\"onmainwindow.cpp\":55",times="0",original-location="\"onmainwindow.cpp\":55"}`
An interesting thing that I noticed is:
Although the debug build have the following configuration:
qmake.exe D:\Elance\X2GoClient\sources_v2.0\x2goclient.pro -r -spec win32-g++ "CONFIG+=debug" "CONFIG+=declarative_debug"
and after that it runs step 2: make:C:\mingw\bin\mingw32-make.exewhere the CINFIG+=debug is mentioned for the debug
the debug output window shows me this:
20:11:11: Configuration unchanged, skipping qmake step.
20:11:11: Starting: "C:\mingw\bin\mingw32-make.exe"
C:/mingw/bin/mingw32-make -f Makefile.Release
is shows:
make -f Makefile.Release..this is very strange
is it ok to show that is building with the makefile from Release?
Thanks
Ok, this might be useful for somebody:
I had the above described problem and solve it with this changes:
Step 1(This problem I think is related to Qt Creator, I think it is build with configure -release instead of configure -debug-and-release flags)
I altered the x2goClient.pro like:
**BEFORE:**
win32-* {
message(building $$TARGET for windows without ldap and cups)
LIBS += -lwinspool -lws2_32
CONFIG += static release
}
**AFTER:**
win32-* {
message(building $$TARGET for windows without ldap and cups)
LIBS += -lwinspool -lws2_32
CONFIG += static debug
}
Step 2(I think due to the fact that Qt might be compiled wrong, the default make.exe step was interpreted as make -f Makefile.release although I selected the Debug build)
In projects->Build Steps->Make arguments
I placed: -f Makefile.Debug
Step 3: After doing these changes, I got several error related to some DLLs. The interesting fact was that Makefile.Debug that was generated by Qt was not generated ok, it contained some dll's like QtCored.dll that wasn't present on Qt, I have changed it as I found the dll's like from QtCored.dll to QtCored4.dll
Step 4: It seemed that the builder and debugger that I had wasn't right. I downloaded the latest MingW and change BOTH builder and debugger. First time I changed only the debugger and got "During startup program exited with code 0xc0000005" Error. When I changed BOTH builder and debugger of the latest MingW it finally worked.
I am working with Qt for 2 weeks now, but I didn't have some much problems with an IDE so far in my life. Qt is good, but it's a bit hardcore to configure.

Error while running make autoannotate sundance_apps 4.3.7

I am trying to install opinionfinder and I getting stuck when i am trying to make autoannotate for sundance apps.
The error log I get is huge and it has all undefined reference errors.
The first line says in function 'my_init_sundance(sunstr,sunstr)' and a list of undefined reference errors.
Anyway i can solve it?
Thanks in advance.
Before trying to compile autoannotate you must make sure Sundance compiled successfully. Check that your sundance-4.37/bin contains: aslog nlp prepro
In order for Sundance to compile on my 64 bit machine I had to edit the Makefile files in both src and include and add -m32 to the CFLAGS variable (or the NormalCC). Also down after the shared_lib_linux: target. Since I am on OSX I also had to add -dynamic flat to NormalOpts and LIBS.

illegal text reloc to non_lazy_ptr error while building in xcode 4 with libav* libraries

I'm trying to build a simple application that uses ffmpeg's libav* libraries in xcode 4 and getting the following error:
ld: illegal text reloc to non_lazy_ptr from /ffmpeg/temp/ffmpeg-0.8/builduni/lib/libavcodec.a(ac3.o) in _ff_ac3_bit_alloc_calc_psd for architecture i386
I've already tried to run ranlib -c libavcodec.a to fix this problem, but nothing happend.
One more thing: my libav* libraries are fat binaries (i386 + x86_64).
Any ideas what can it be?
I have the same error. Finally, I got the solution at
http://lists.apple.com/archives/unix-porting/2008/Jan/msg00027.html
just add other link flag:
-read_only_relocs suppress
* EXPLANATION * The two assembly commands load the absolutes address of _trail into R15. Doing so is fine if _trail is ultimately
in the same linkage unit. _trail is in libmodule.dylib. For this to
work, at runtime the dynamic loader (dyld) would have to rewrite the
two instructions. Normally dyld only updates data pointers. One work
around is to make libdyalog an archive (e.g. libdyalog.a) and link
that with pere.s. Then all the code would be in the same linkage unit,
so there would be no need for runtime text relocs. The runtime (dyld)
does support text relocs (updating instructions) for i386, but you
need to link with -read_only_relocs suppress.

Compc (Actionscript Library Compiler) Doesn't Fail Unless I Delete the File First?

Here's the scenario: I run compc on a source directory to recompile an already existing library after some changes, which completes successfully. Then I remove the library (the .swc file) and re-compile, which causes many errors to be thrown.
Nothing changed in the interim - clearly this should have either succeeded both times or failed both times.
libs/pv3ddebug $ compc -library-path+=.. -source-path=./src -compiler.optimize -include-sources+=./src -output ../pv3ddebug.swc
Loading configuration file /Users/bill/flex_sdk_3/frameworks/flex-config.xml
/Users/bill/lg/vision/libs/pv3ddebug.swc (152944 bytes)
/libs/pv3ddebug $ rm ../pv3ddebug.swc
/libs/pv3ddebug $ compc -library-path+=.. -source-path=./src -compiler.optimize -include-sources+=./src -output ../pv3ddebug.swc
Loading configuration file /Users/bill/flex_sdk_3/frameworks/flex-config.xml
/Users/bill/lg/vision/libs/pv3ddebug/src/com/phenomblue/pv3ddebug/PV3DDebug.as(45): col: 34 Error: Type was not found or was not a compile-time constant: AdvancedView.
public function PV3DDebug(view:AdvancedView)
^
... more errors follow
I think I've found out why the errors are happening, and can correct them, but I'm disturbed that the first compile didn't fail.
I have a theory:
Library A, which pv3ddebug depends on, was correct
pv3ddebug was compiled successfully (and it correctly)
Library A was brought into a state that would fail to compile with pv3ddebug
pv3ddebug was compiled successfully, incorrectly, because compc didn't notice that A was updated to a failing state
deleting pv3ddebug and then recompiling caused compc to try and compile with the new A, and so the compilation failed.
My questions to you: is step 4 a bug? Is this caching behavior I should have expected, or can change with a compiler switch? Is there something going on that my theory doesn't explain?
You could try -incremental=false. This is supposed to be the default for the command line compiler, but what you're describing sounds like it's enabled.

Resources