Using OpenCL in linux and IDEs - ide

For using OpenCL in linux should I have NVIDIA GPU?
In my computer I have an Intel GPU and i3 Intel CPU supported SSE3 and SSE4, I want program whith OpenCL in windows can I use an other IDE than "Visual Studio" for example "Code Blocks"?
Thank you

You can use OpenCL with any GPU, as it can run on a CPU as well (that's one of the strong points of OpenCL vs CUDA and the like).
But if you want OpenCL to actually use your GPU and not (or not only) your CPU, you will have to have a driver for your GPU which supports OpenCL, e.g. AMD or NVIDIA. Intel also lists Intel HD and Intel Iris graphic chips as supported through their OpenCL SDK, but you should probably check what you're actually running on if you want to make sure (e.g. check at the start of your program - see Appendix A).
Also, OpenCL has NOTHING to do with CPU extensions like SSE (specific implementations may use SSE/AVX/whatever CPU extension for better performance, but OpenCL does not require any of those per se), or with the IDE you use, and only very little with operating system. So you're free to use whichever IDE you want to (at the end, the IDE is only the editor you write your code with). In the case of Visual Studio people often tend to mix IDE with compiler, as Visual Studio uses it's own compiler per default, but afaik even there you're free to change it to e.g. the mingw or cygwin provided compiler, or use the icc. (Feel free to correct me on the Visual Studio part as I've only tested it once before completely wiping it forever)
Appendix A: How to check which devices can be used by OpenCL on a given system http://dhruba.name/2012/08/14/opencl-cookbook-listing-all-devices-and-their-critical-attributes/

Related

Instruction set: how to test an external library

Depending on the CPU architecture, some computers can run software with some specific instruction set. Using these instructions can greatly improve the speed of the program, but can also lead to crashes when not supported.
But sometimes, when shipping a software that depends on external libraries (binaries), we may want to check what instruction set they rely on (like AVX2, SSE2, etc) and assess if we can use safely this library or executable (e.g.: on Windows, a .lib, .dll or an .exe). Mostly when the final executable has to be shipped to hardware that is out of our control, but should follow some specifications.
Most of the related questions seems to tackle the problem the other way around: from the software, to check if a set of instruction is supported on the current hardware:
how verify that operating system support avx2 instructions
Detecting SIMD instruction sets to be used with C++ Macros in Visual Studio 2015
How one can check, from the binary, what kind of instruction sets are required or used? Is there some OS tools for that?
The OSs of interest would be Windows, Linux and MacOS.

A program that supports different types of GPU

If i want to develop A program that supports different types of GPU.what should i do? I know that OPENCL can do this.but how OPENCL did this?
OpenCL is the best choice for vendor-independent GPU programming.
The way it works is runtime-compilation: You compile C++ to an executable and this executable contains the OpenCL C source code as text/string. When you run the executable on the CPU, it compiles the OpenCL C code specifically for the installed GPU. The OpenCL compiler is provided as part of the graphics driver. This way, you can copy the executable to another computer and there the contained OpenCL C code can compiled for a different GPU, all without having to recompile the executable.
This is similar to how Java works.

Why can an executable run on both Intel and AMD processors?

How is it that an executable can work on both AMD and Intel systems. Aren't AMD's and Intel's instruction sets different? How does the executable work on both? How exactly do they compile the files to work like that. And what exactly is the role of the OS in all this?
The only real difference between AMD and Intel at a given processor iteration is their implementation of the instruction sets they support. x86 (32 bit) and x64 (64 bit) are the two most common instruction sets for Intel and AMD processors.
The differences come in when Intel and AMD implement the instruction sets in their chips - but these implementations should have no effect on the instruction sets themselves. So if a program was compiled for an x64 processor, it can run on any processor that implements the x64 instruction set, which almost all modern Intel and AMD processors implement.
A great example of an implementation difference is the way that Intel likes to hyperthread cores whereas AMD likes to just add more cores. They do this for a multitude of reasons, such as power consumption and better concurrent processing, but it doesn't really impact if programs run because it doesn't change the instruction set. Another difference between Intel and AMD is the number of pipeline stages, which can affect speed.
Huge complexities come into play when operating systems are considered. Windows has huge libraries that programs have to use if they want to run on windows. The same goes for Linux and Mac OS X. Since these libraries aren't shared between operating systems, programs written on one operating system probably won't run on another.
Essentially these days, compilation is done for the OS not for hardware, as most hardware have universal protocols and/or tech, as mentioned above, x86 or x64 machine code/opcodes/instruction sets, some programmers do make software designed to run better on certain hardware i.e optimized for AMD or Intel etc...
but still have other versions for other hardware
mainly due to the OS you need to worry about bit length and or running OS
most compilers or software makers tend to compile out to shared machine code instead of manufacturer specific, it should be remember different people use the same things in a different way, the guys in MIT, may decide to code their own OS for their needs and may want to use advance specific features of Intel ins tsrcution set some people fully re do their own androids etc...

Is installing MONO on an IBM RISC running AIX possible and or practical? And if so where do I start?

Is installing MONO on an IBM RISC running AIX possible and or practical?
And if so where do I start?
AIX is not one of Mono's supported platforms.
From the FAQ:
Mono currently runs on Linux, Windows, Solaris, FreeBSD and MacOS X. The Just-In-Time engine (JIT) is available on x86 and PowerPC, Sparc and S390 processors and can generate code and optimizations tailored for a particular CPU. Interpreters exist for the Itanium, HP-PA, StrongARM CPUs.
You could always download the source, and compile it yourself, after working out the platform specifics. Namely, the JITter would need to be ported to handle the processor.

What pascal compilers can target embedded ARM with no OS?

Looks like available Pascal compilers can only produce binaries for ARM on Linux. Is there established version of compiler/bundle for just bare ARM cpu with zero extra software preinstalled ?
To clarify, I am looking for high quality, compact tool (alternative to commercial C, open source C) for kernel-less, plain embedded CPU with all software in one plain ROM ? IDE with debugging capabilities is nice to have, but not necessary. Dubugger could actually be some different 3rd party generic IDE. I hope that compilers can dump the debug/symbols info in some standard form.
Thank you
Free Pascal Compiler supports ARM without any OS. They call it TARGET EMBEDDED.
For ARM Linux take a look at this and this.
There is also Lazarus CT edition cross compiler which seams to target sysless ARM too.
UPDATE 1: mikroElektronika has also recently made Pascal compiler for ARM.
UPDATE 2: Ultibo framework for bare metal Raspberry Pi programming looks outstanding.