Can not find the icc compiler after having installed Intel oneAPI, invoking from bash on Ubuntu 20 - icc

my problem is that I want to invoke the icc compiler from the commandline, but my pc can't find it. I have install the latest oneAPI and sourced setvars.sh.
Even I search 'icc' file under the installation routine I can't find the icc compiler file.
'which' command works for mpicc and dpcpp but not for icc
can not find icc///
mpicc found but not icc

It looks like you might have installed Intel OneAPI base toolkit. The icc compiler is not a part of the base toolkit. To get icc(IntelĀ® C++ Compiler Classic) you should install Intel OneAPI HPC toolkit. Below is a link to HPC toolkit. You would see icc in the "whats included" section
https://software.intel.com/content/www/us/en/develop/tools/oneapi/hpc-toolkit.html
You could install hpc toolkit on the top of your basekit, it installs only whatever is not present as a part of base toolkit.

icc is the "classic" compiler:
apt install intel-oneapi-compiler-dpcpp-cpp-and-cpp-classic

do remember to source setvars.sh in your bash.rc
cheers

Related

why does the error regarding gcc is occuring in matlab?

I have download that code from github.
Whenever that code tries to check mexopencv (a file inside lib folder). It shows an error on Matlab 2017a that is:
[error 3] please make sure gcc >= 4.4 g++ >= 4.4 is installed ...
I am having a gcc version of 8.8.0
Following is the description of system
Window 10
Visual Studio 2012
Matlab 2017a
opencv 2.4.10
mexopencv (install from your folder LIB)
You might lack of standard libraries (.dll in Windows but .lib in Linux). The code was developed under Linux (help is also only provided for Linux systems) and once tested under Windows 7.
The method was tested under OS linux lubuntu 14.04, CPU intel i5 and
16GB of RAM. This guide was written under a linux-based distribution
scope, more precisely debian. Unfortunately we lack experience to
address bugs or any problem that could emerge in non-linux OS, we will
provide only linux OS help regarding execution problems, we apologise.
we tested this code on Windows7. We successfully installed opencv
2.4.10 following this tutorial: [http://www.learnopencv.com/install-opencv3-on-windows/]
This suggests that the mex-function is also linux-based. The error should vanish if you compile the source code yourself on your system, e.g. with MinGW (also GCC), see here.
EDITED:
the README.markdown file (under LIB/mexopencv-master.zip) provides a little guide through the installation process of both, openCV and the mexopencv function for unix (including ubuntu 14.04) and Windows systems. The latter states:
Browse to mexopencv root folder, and type the following in the MATLAB
command window:
>> mexopencv.make
By default, mexopencv assumes the OpenCV library is installed in
C:\opencv. If this is not the case, specify the path as an argument:
>> mexopencv.make('opencv_path', 'c:\your\path\to\opencv')
Note that if you build OpenCV from source, this path specification
might not work out of the box. You need to replace dll files in the
OpenCV package with newly built binaries. Or, you need to modify
+mexopencv/make.m to correctly link your MEX-files with the library.
To remove existing mexopencv binaries, use the following command.
>> mexopencv.make('clean', true)
It requires a standard C++ compiler supported by Matlab (see here), any Visual Studio installation should be OK, as an open-source option MinGW is recommended. Just remember to pick the right system (usually 64-bit).

Matlab supportpackageinstaller not presemt

I have just installed a fresh copy of elementary OS freya in my lappy and after that did an installation of matlab R2012b. First I tried using the image acquisition commands but they didn't work as the library was not there. To install I typed
supportpackageinstaller
but it gave an error
Undefined function or variable 'supportPackageInstaller'.
This is the first time I am installing matlab on linux so I don't know how to solve the problem.
copied from: http://www.mathworks.com/matlabcentral/answers/88896-how-to-install-add-on
the supportPackageInstaller is a new feature in R2013b and doesn't exist in older releases than R2013b. Which version are you using? If its not 13b you need to look up the support package on the File Exchange. Only for example Simulink Support Package for Arduino Mega 2560 Hardware (R2012a)
refer to another:
http://148.204.81.206/simulink/ug/start-support-package-installer.html#
Start Support Package Installer
You can use Support Package Installer to install support for specific third-party hardware and software products.
Support Package Installer guides you through the process of downloading and installing a support package.
To start Support Package Installer, use one of the following methods:
In a MATLABĀ® Command Window, enter targetinstaller.
In a model, select Tools > Run on Target Hardware > Install/Update Support Package.
Double-click a *.mlpkginstall file.
On the MATLAB tool strip, click Add-Ons and select Get Hardware Support Packages.

How to compile distributable Fortran binaries on Mac OS X Mountain Lion?

Since Apple have stopped distributing gfortran with Xcode, how should I compile architecture independent Fortran code? I have Mac OS X Mountain Lion (10.8), and XCode 4.4 installed, with the Command Line Tools package installed.
Apple's Native Compilers
As far as I can tell, the Xcode C / C++ / ObjC compilers use a fork of the GNU compiler collection, with llvm as a backend; the latter I figure enables compiling and optimising "universal" binaries, for both Intel and PPC architectures.
3rd party binary Fortran compilers
HPC
I've only found a single website that distributes a binary version of gfortran specifically for Mountain Lion: the HPC website. However, I failed to get this to compile SciPy, and later saw in SciPy's README that it is "known to generate buggy scipy binaries".
CRAN/R
SciPy's recommended (free) Fortran compiler is the one on CRAN's R server, but this has not been updated for Mountain Lion yet. They provide instructions and a script for Building a Universal Compiler, but, again, this hasn't been updated for Mountain Lion yet..
G95
The G95 project hasn't had an update since 2010, so I didn't try it.. Anyone tried this on Mountain Lion?
MacPorts
I guess this will be the easiest way to get gfortran installed, but port search gfortran comes up with nothing, and I've not had any joy with MacPorts in the past (no offence to MacPorts; it's looks like a very active project, but I've been spoilt with Linux package managers, my favourite manager being aptitude) so on Mac OS X I've compiled software and libraries from source code in the past. Never been a problem 'til now...
Building a Fortran compiler
Having dug around on the internet a lot in the last couple of days, I've found other Fortran compilers, but I've failed to get any to cross-compile universal binaries, or to compile SciPy.
GCC - The Gnu Compiler Collection
I compiled the entire GCC collection (v4.6.3), including autotools, automake, libtool and m4 - like the GCC wiki and this blog describe - but the resulting compilers didn't compile universal binaries, probably because LLVM wasn't used as a backend.
DragonEgg
DragonEgg is a "gcc plugin that replaces GCC's optimisers and code-generators ... with LLVM". This looks interesting, but I don't know how I could use it to compile 'llvm-gfortran-4.x'. Can this be done?
Compatibility
Libraries
The compiler that comes with Xcode is (a fork of?) GCC v4.2. But GCC's current release and development branches are versions 4.6 and 4.7, respectively. Apparently, a GNU license change, or something, stopped Apple from updating to more modern versions of GCC. So, if I was to build dynamic libraries made with GCC's gfortran v4.6, could they then be linked with C code compiled by Xcode's native compiler? At a minimum, I figure resulting Mach-O binaries need both x86_64 and i386 code paths. Do GCC provide backwards compatibility with Apple's (forks of?) GCC? I know gfortran has the -ff2c flag, but is this stable across versions?
Compile flags
The GCC Fortran compiler I built from source didn't support the use of the -arch compile flag. I had been including the flags -arch x86_64 -arch i386 in both CFLAGS and FFLAGS environment variables on earlier OSX versions (Snow Leopard to Lion). Python's distutils, and probably other OSX compilers, expect these flags to work, when configured to build apps or frameworks, using Xcode's universal SDK.
In case you're wondering what compile flags I use, I've uploaded the script I use to pastebin, which I source before I compile anything, using: source ~/.bash_devenv.
The Ideal OSX Fortran Compiler
Create ppc and intel (32 and 64bit) universal binaries, specified by using the -arch flags.
Makes binaries compatible with XCode's linker.
Compiles SciPy, giving no errors (compatible with numpy's distutils and f2py).
I don't use Xcode so much, but integration with it would surely benefit other users. Even Intel are still having problems integrating ifort into Xcode 4.4, so this is not something I expect to work..
If you read all the above, then thank you! You can probably tell that I'm not averse to building my own Fortran compiler from source, but is it even possible? Have I missed something? A configure flag maybe? And if such a compiler is not available yet, then why not?!
(Update:) Apple's GCC
Apple provide the source code for their patched version of GCC, at opensource.apple.com. This actually includes the source code for gfortran, but what do you know - it doesn't compile (easily). I'm in the process of writing a build script to get this to work. Unfortunately, I've had to apply a couple of patches, and learn about "the Apple way" of building GNU software. This is the way to go I think. Any reasons why it shouldn't be? I'll update with an answer if I get it to work...
I managed to compile after installing gfortran from http://r.research.att.com/tools/gcc-42-5666.3-darwin11.pkg, as explained here. I had to try to open the package a couple of times, though. First time it said that only apps from App Store can be installed. After installing gfortran, python setup.py build and python setup.py install worked fine. The unit tests of scipy though give a fairly high number of fails, not sure it's normal.
Ran 5481 tests in 82.079s
FAILED (KNOWNFAIL=13, SKIP=42, errors=11, failures=72)
<nose.result.TextTestResult run=5481 errors=11 failures=72>
In case you didn't already notice this: In newer versions of Xcode you have to explicitly install command line tools in the following way:
Preferences -> Downloads -> Components
And then click the "install" button for command line tools. This includes gfortran:
> gfortran -v
Using built-in specs.
Target: i686-apple-darwin10
Thread model: posix
gcc version 4.2.1 (Apple Inc. build 5664)
Admittedly, this does not solve all of my fortran needs (in some cases "./configure" scripts will complain that they cannot "compile a simple fotran program").
You could use brew (or Homebrew) to install gfortran.
$ brew install gfortran
I know you said you don't like MacPorts, but if you install the gcc48 port, it does in fact include gfortran (although you'll also have to do sudo port select --set gcc mp-gcc48 to get it to set up the symlink named gfortran).
Also, FWIW, the MacPorts option is not necessarily a binary - MacPorts can actually build it from source, which is why it sometimes takes a while. On the other hand, it also sometimes seems to get archived binaries from somewhere, but I think it depends on what the original author of the portfile uploaded.
I ended up compiling gfortran the source code provided at Apple's developer tools source code page. This seems to be working okay now - I've successfully compiled x86-64 and i386/i686 LAPACK, ATLAS and BLAS fortran libraries - but there are some ranlib tests which fail, when running make -k test in the build directories. (I could provide more info on that pastebin or somewhere, if someone wants...)
Build process
After asking the question, I downloaded Apple's llvmgcc42 source code tar archive, which includes the source code for llvm/gcc C, C++, ObjC and fortran compilers, and spent some time trying to compile a universal build of gfortran. The build takes about 30-60 minutes on my quad-core 2.8GHz Mac Pro, and became quite an involved process, so I wrote a set of build scripts for it, which I've shared at github.com.
....
I'll keep a tar archive of my build here for the time being, if anyone would like a copy. (Updated 26-Sep-2012) It'll only work if installed with a prefix of /usr/local/ though, unless you run install_name_tool on the executables and dylibs, to change the prefix from /usr/local to wherever you want to put it. You can test install_name's with otool -L filename (more info on the reasons for this is here).
The final build I'm now using also includes updates to the gcc/fortran and libgfortran directories, which I got from GNU GCC 4.2.4. These sources I got from my local GCC's mirror. There were only minor changes between 4.2.1 and 4.2.4, and the build scripts include the patches needed to upgrade the code.
The build-gfortran.sh script I wrote downloads missing dependencies (mpfr and gmp), compiles and cross-compiles them, patches differing headers with architecture-dependent preprocessor macros, and runs lipo to create universal binaries and libraries, eventually supporting both i386 and x86_64 architectures. The process is similar for llvmCore, and then GCC. I mostly copied code from the build_llvm and build_gcc bash scripts provided with Apple's llvmgcc42, but had some of it had to be modified, including a few lipo and install_name_tool commands.
The official way to compile Apple's gcc, using Xcode's gnumake just didn't work for me. I thought this should work just byadding "fortran" to the LANGUAGES variable in build_gcc.
With regards to compiling Scipy, still can't get that building perfectly. I've had to use clang and clang++ as C/C++ compilers, or else I get EXC_BAD_ACCESS malloc errors. Haven't tried the gcc/g++ compilers I built, just used the system ones. This is as reported for Lion, on the Scipy install page. I'm down to 11 errors and 1 failure, which are all raised from the same 3 function calls (_fitpack._bspleval, numeric.asarray, testing.utils.chk_same_position). Think that's pretty good, but I'd like every test to pass...

Is it possible to create a win64 MEX file that does not require Microsoft Visual C++ Runtime libraries

I am trying to see if you can distribute a MEX file without requiring the end user to install the C++ runtime libraries.
When you use visual 2010 express to create MEXs, Matlab issues this warning :
Warning: Applications/components generated using Microsoft Visual C++
2010 require that the Microsoft Visual Studio 2010 run-time
libraries be available on the computer used for deployment.
To redistribute your applications/components, be sure that the
deployment machine has these run-time libraries.
Is there a compiler that doesn't require to install the run-time libraries on the end machine?
Yes there is: MinGW(-w64) GCC. It only links to the OS library msvcrt.dll (when you link with the -static option), which requires no installation and is part of Windows.
To get Matlab to work with that, you'll need to jump through some hoops. Here is some information. Ignore the Cygwin stuff, and be sure to use a MinGW-w64 toolchain targetting x64 Windows from the link above. Note I haven't personally tested this, but this is your best bet. It's also unsupported by Mathworks, so you are on your own.
As an aside, what's the problem with installing the MSVC++2010 redistributable anyways? There's no effect on licensing, and running MEX code implies having Matlab installed. Installing one more little thing won't be that much trouble IMHO.

How do you set up an x64 development environment based on gcc and eclipse?

I want to create 64 bit apps for (for example) 64 bit Windows 7. I've searched the web and found some help but couldn't get it to work.
Sorry I've taken so long to respond but I have tried to get the packages suggested to work but they're not easy or else I'm doing something wrong.
Anyway I ran across an environment called pellesc. It consists of a development environment around a compiler which traces is roots back to a 32-bit version that was once (according to Wikipedia) used to develop Quake. From what I've seen so far it's very promising and generates good code too!
In spite of what other people are saying, Eclipse actually has very good support for C++, even in Windows: check out the CDT project. It's very mature and well-supported -- it works for C/C++ at least as well as Eclipse JDT works for Java.
As for the compiler itself, VonC is right, MinGW-w64 (but the mingw-w64 project is moving to mingw-w64.org so i suggest to use mingw-w64.org) is the best option. Eclipse CDT has built-in support for MinGW so as long as you install MinGW first, Eclipse should automatically detect it.
This Eclipse MinGW64 tutorial mentions:
update (Nov 9, 2010): recent MinGW-w64 versions come with 'as', 'g++', and 'gcc' commands. This step may be unnecessary in your MinGW build.
Meaning you won't have anymore to update the GCC assembler, C++ compiler, C compiler and C++ linker, with 'x86_64-w64-mingw32-as', 'x86_64-w64-mingw32-g++', 'x86_64-w64-mingw32-gcc', and 'x86_64-w64-mingw32-g++'.
Other great source for w64 development tools:
Native windows x64 software develop with Mingw-w64 on drangon.org
A 64-bit version of GCC for Windows is available at http://tdm-gcc.tdragon.net/download. I can't see why you would want to use Eclipse for C or C++ programming - try the Code::Blocks IDE at http://www.codeblocks.org instead.
Honestly, I use cygwin. Its compatable with unix so you can easily move systems and has tons of functionality that is gcc friendly (autoconf, make, makedepends, ...). To use gcc to compile to 64 bit add the -m64 option. To compile for windows use the -mno-cygwin option. Make sure though that you're using gcc 3 and not 4 (then you'd use the mingw compiler series). Otherwise, its all the same as unix which is really useful.