Remove errors in clgpustress C++ GPU stress code - c++

I opened the C++ code from clgpustress in Visual Studio 2010 but it shows many errors, as seen in the following image:
How to add the libraries? Or is there another C++ gpu stress code?

I am author of the clgpustress.
clgpustress requires the popt library which provides the command line
parsing.
Unfortunatelly, popt is not too much portable and it is compilable under
Unix/Linux systems. I created on the github special version of a popt library
here: https://github.com/matszpk/popt-msvc.
This version was created to be compilable under MSVC and Windows.
Download that version and try to compile and link with clgpustress.
CLgpustress is an OpenCL application, so it requires the OpenCL runtimes and development libraries which can be found in AMDAPP package.

Related

Open CL programming with G++ in Windows

I am trying to write Open CL programs in C++ using G++ compiler in Windows 10 but I am not able to find any SDK for my work.
Nvidia CUDA requires Visual Studio compilers to work and AMD AMP SDK seems to be discontinued saying that the libraries are included in the driver itself.
My PC has both AMD and Nvidia GPUs so any of the implementation should be fine with OpenCL. Can anyone suggest how can I carry on and also kindly clarify on how to use the libraries present in OpenCL driver in my C++ program as mentioned by AMD if possible?
Edit :
I found out that OpenCL libraries are already present in Windows as,
C:\Windows\System32\OpenCL.dll
We only need headers to compile our program using g++. It can be done as shown below.
Install OpenCL headers from below,
https://packages.msys2.org/package/mingw-w64-x86_64-opencl-headers
Once headers are present in include directory of MinGW64, I wrote my program normally and compiled the program using the below g++ command.
g++ main.cpp C:\Windows\System32\OpenCL.dll -o main.exe
And that's it. It worked !!!
http://arkanis.de/weblog/2014-11-25-minimal-opencl-development-on-windows was of great help to understand the OpenCL library implementation in Windows.
You don't need to install anything besides Visual Studio Community with the C++ compiler, and GPU drivers (these already contain the OpenCL runtimes).
For OpenCL development, you only need the OpenCL header files and the lib file. To setup Visual Studio, see here. This works for any OpenCL device, including Nvidia/AMD/Intel GPUs and even Intel CPUs if the CPU runtime is installed.
Alternatively, you can use my lightweight OpenCL-Wrapper. This comes with all Visual Studio settings already in the project file. OpenCL learning and developing with the wrapper is so much simpler than with the cumbersome OpenCL bindings directly.

Use Shared Object (.so) in a C++ project develop in Windows with Visual Studio for Linux using WSL

For a task I have I must develop C++ code for Linux but from Windows. I'm using Visual Studio 2019 with WSL 2 and the tests I've run worked well, it compile .out/.so/.a and giving me the ability to debug the code as if it was a regular project.
The problem is when I need to link external .so to my project. In regular Windows-VS-c++ development I define the input linker to the directory of the .lib. But in Linux their no .lib (or is their? I'm not familiar with Linux-C++).
In short how do I consume Shared Object (.so) files from another project using Visual Studio 2019 compiling for Linux using WSL 2 ?
Ask your boss permission to install Linux on your work computer
(e.g. some genuine Linux distribution such as Debian or Ubuntu in some separate disk partition). This is -in terms of effort and your time- the cheapest route to follow.
Read of course Advanced Linux Programming, syscalls(2), How to write shared libraries, dlopen(3), proc(5), elf(5), ld.so(8), the Program Library HowTo, the C++ dlopen minihowto, the documentation of GCC, the documentation of GNU make, the documentation of GNU binutils, the documentation of GDB.
Of course, read more about programming in C++. C++ is a difficult language (on both Linux and Windows). Refer to this website. Read later the C++11 standard n3337.
If you code a single C++ translation unit foo.cc (you could use GNU emacs to edit it), compile it first into a shared object foo.so using a command g++ -Wall -Wextra -g -fPIC -shared foo.cc -o foo.so (all warnings, DWARF debug information, position independent code).
If your C++ shared library is built from several C++ translation units, learn how to use a build automation tool such as GNU make or ninja. And use it in a terminal emulator on the command line. Be aware of ASLR. Use strace(1), ltrace(1), gdb(1) to understand the dynamic behavior of your or others software.
In some cases, generating parts of your C++ code (e.g. with ANTLR or SWIG) is worthwhile. Notice that Qt is doing so.
Consider using some cross-platform C++ frameworks such as Qt or POCO.
For some projects, writing your GCC plugin could be useful. See this draft report.
In short how do I consume Shared Object (.so) files from another project using Visual Studio 2019 compiling for Linux using WSL 2 ?
Don't use Visual Studio (I never used it myself, but according to rumors it is unfit for cross-compilation from Windows to Linux). Perhaps use Visual Studio Code (to which I prefer GNU emacs, but you might try gedit, geany, vim, kate etc...)
On Linux, all IDE for C++ programming would run a GCC or Clang compiler (and you'll need to understand what compilation command they are running for you). You could also be interested by the Clang static analyzer or by Frama-C++
Take inspiration from existing open source C++ projects on Linux
Look on github or gitlab - e.g. libonion, Qt, FLTK, fish, icecream) ... Read also Linux From Scratch.
above all, approach Linux programming with a fresh and open mindset.
Read about the Unix philosophy, it is relevant on Linux. And very different from Microsoft design ideas related to Windows.
I never used Windows (and I am coding since 1974), but my biased opinion is that WSL is targeted for Linux gurus who (sadly for them) have to use Windows. I believe WSL is not targeting Linux newbies.

Tesseract + OpenCV + linux

I have developed an OCR application on Windows using OpenCV and Tesseract. Now all I want to do is to write same application over Linux (Ubuntu 12.10) in C++. And I don't have any experience in Linux development. I don't know where to start. All I want is developing environment in which I would able to link these two libraries OpenCV and Tesseract.
Please suggest me. I have tried searching Google but failed. Maybe I am not searching with good keywords. As I am totally new in Linux
First make sure that you compiled OpenCV on your system, as OpenCV's linux bundle hasn't got pre-compiled libs (unlike Windows bundle). Follow this tutorial.
For a starting point, build up Eclipse as IDE and follow this tutorial. It shouldn't be so hard to adopt if you already used Visual Studio (MSVC Windows compiler).
Later on, it would be wise to learn about gcc (official linux compiler for your c++ code) and its syntax, and maybe together with CMake. Because learning the terminal and g++ syntax suddenly accelerates the development process. Linux has got many opportunities for a developer, such as pkg-config, which links all the libs and headers automatically (well, almost). You can also go for learning CMake for cross platform development and let it use "gcc" by default; example here.
Also note that, using cygwin, you can actually compile & build linux binaries on a Windows platform. For the opposite; check MinGW.
Good luck.
EDIT: other cross platform solutions
VisualGDB
Qt

GLib syntax errors, while compiling libnice with latest GLib for win32

Some necessary background:
Libnice (p2p library) was meant to be compiled using 2.28 Glib (here's win32 compilation readme https://github.com/jcaden/libnice/blob/master/README.win32),
BUT the official example
(this one http://cgit.collabora.com/git/user/kakaroto/libnice.git/plain/examples/sdp-example.c),
implementing compiled before libnice, obviously was written using latest glib stuff.
I assume, it is possible to rewrite example for the older one, but latest glib is more elegant and cool all around, that's why I got a wish to use it.
Now, my question:
While trying to compile Libnice using latest GLib (got it from here http://www.gtk.org/download/win32.php) for win32, using Visual Studio 2010, I encounter some syntax errors (Many of them).
You can see log here https://gist.github.com/anonymous/71e2a80e57eb4b8ae6c1
Is it fixable, and how?
P.S: to use latest GLib, I downloaded same stuff, that was described in readme; i.e Glib dev and runtime and zlib and gettext runtime.

Compile A MSVC++2010 Project So It Can Run On Ubuntu

I have a MSVC++ 2010 project. All the libraries it's using are cross platform (SDL, OpenGL and FLTK).
Obviously, all I have to do right now is press the debug button and it will compile a nice old .exe for me which can now run on Windows, as long as the DLL files are with it.
I had thought before that if you use cross platform libraries, then the generated .exe would run fine on Ubuntu too. I recently found out that this is not possible, and that the program must be compiled in a special way to run on a certain platform.
Is it possible to compile my project in this magical way with MSVC++ 2010 so that it can run on a Ubuntu computer? If so, then could you please answer my question with some clear steps as to what I should do to compile it this way, keeping in mind I'm new to how all this cross platform stuff works?
EDIT:
If I cannot compile a MSVC++ 2010 project for Ubuntu, is there an IDE I could use that could compile the project for both Windows and Ubuntu?
Thanks.
I suggest you use QT. http://qt.digia.com/
It's probably the best cross platform IDE that can let you compile for Windows, Mac and Linux(ubuntu) systems.
Nope, not possible. While the binary code corresponding to the program can be portable, that's not enough. Executable formats on various file systems are different and not compatible. The executable format is essentially a packaging of the binary data and wrapping it with a header that the target file system understands. In order to produce executables for Ubuntu, the linker must support it. MSVC++ doesn't support Linux formats.