CrazyEngineers Archive
Old, but evergreen and popular discussions on CrazyEngineers, presented to you in read-only mode.
@rukawa • 03 Nov, 2013
Hello everybody,
I've recently installed the intel's icc compiler, but I'm still unable to use it because everytime I try to compile my c programs using it I get the message :
icc : command not found
I reinstalled the icc compiler, but I still have the same problem.
Should I make some modifications somewhere in some file so that the operating system takes this newly unstalled software into account? What could be the source of the problem?
I have an UBUNTU 12.04 by the way.
@Abhishek Rawal • 03 Nov, 2013 amd64 or i386 system ?
@rukawa • 03 Nov, 2013
Abhishek Rawal
amd64 or i386 system ?
amd64
@Abhishek Rawal • 03 Nov, 2013 have you installed ia32-libs ?
apt-get ia32-libs

And still problem persist, check in directory : /opt whether folder name 'intel' exist or not.
@rukawa • 03 Nov, 2013
Abhishek Rawal
have you installed ia32-libs ?
apt-get ia32-libs

And still problem persist, check in directory : /opt whether folder name 'intel' exist or not.
I installed ia32-libs, and I checked /opt and the folder name 'intel' exists. I still have the same problem though.
@Abhishek Rawal • 03 Nov, 2013 Okay that's good,
Open terminal & type
gedit ~/.bashrc 
enter this line at end of file :
export PATH=$PATH:/opt/intel/bin 
save it.
Now,type in terminal
 source ~/.bashrc 
@rukawa • 03 Nov, 2013
Abhishek Rawal
Okay that's good,
Open terminal & type
gedit ~/.bashrc 
enter this line at end of file :
export PATH=$PATH:/opt/intel/bin 
save it.
Now,type in terminal
source ~/.bashrc 
I entered the following line at the end of the file :
export PATH=$PATH:/opt/intel/bin 
but when I type :
rukawa@ruka:~$ sudo ~/.bashrc
I get the following message:
sudo: /home/rukawa/.bashrc: command not found
I tried to do it without sudo and I got this :
rukawa@ruka:~$ ~/.bashrc
bash: /home/rukawa/.bashrc: Permission denied
@Abhishek Rawal • 03 Nov, 2013 Open /Home, Press Ctrl+H to show hidden files, there will be file named .bashrc open it using any editor you like.
111
@rukawa • 03 Nov, 2013
Abhishek Rawal
Open /Home, Press Ctrl+H to show hidden files, there will be file named .bashrc open it using any editor you like.
111
I did that
@Abhishek Rawal • 03 Nov, 2013
rukawa
I did that
make it executable
sudo chmod 755 <to the directory>

or simply right click on file & click on 'make it executable'

and it's
 source ~/.bashrc 
@rukawa • 03 Nov, 2013
Abhishek Rawal
make it executable
sudo chmod 755 <to the directory>

or simply right click on file & click on 'make it executable'

and it's
 source ~/.bashrc 
I made it executable and executed the following command without problems:
 source ~/.bashrc 
@Abhishek Rawal • 03 Nov, 2013
rukawa
I made it executable and executed the following command without problems:
 source ~/.bashrc 
now compile your C code using icc commands. It will compile with icc compiler.
@rukawa • 03 Nov, 2013
Abhishek Rawal
now compile your C code using icc commands. It will compile with icc compiler.
I'm really sorry, but it didn't solve the problem, I still get the message :
icc : command not found
@Abhishek Rawal • 03 Nov, 2013 Tell me the output of
 sudo /opt/intel/bin/link_install.sh -s 
@rukawa • 03 Nov, 2013
Abhishek Rawal
Tell me the output of
 sudo /opt/intel/bin/link_install.sh -s 
I get the following message :
sudo: /opt/intel/bin/link_install.sh: command not found
@Abhishek Rawal • 03 Nov, 2013
rukawa
I get the following message :
sudo: /opt/intel/bin/link_install.sh: command not found
show me output of
 ls /opt/intel/bin 
------------------------------------------------------------------
Sorry, I am trying my best to help you & eventually in next few minutes it will be solved. I haven't installed ICC right now, I installed ICC almost a year ago, so it's bit hard to solve query when my system don't have it installed.Still we will solve it.
Patience is the key 😀
@rukawa • 03 Nov, 2013
Abhishek Rawal
show me output of
 ls /opt/intel/bin 
------------------------------------------------------------------
Sorry, I am trying my best to help you & eventually in next few minutes it will be solved. I haven't installed ICC right now, I installed ICC almost a year ago, so it's bit hard to solve query when my system don't have it installed.Still we will solve it.
Patience is the key 😀
I thank you very much sir and appreciate your help 😀

rukawa@ruka:/opt/intel$ ls /opt/intel/bin
compilervars.csh idb inspxe-inject inspxe-wrap
compilervars.sh idbc inspxe-runsc
rukawa@ruka:/opt/intel$
@Abhishek Rawal • 03 Nov, 2013 Alright, now tell me in detail, which packages you have really installed ?
Have you installed Intel C++ composer XE ?
have you installed Intel Fortran composer ?
you have to install both.
@rukawa • 03 Nov, 2013
Abhishek Rawal
Alright, now tell me in detail, which packages you have really installed ?
Have you installed Intel C++ composer XE ?
have you installed Intel Fortran composer ?
you have to install both.

I installed the intel C++ composer XE, because I'm only having C programs, why do I have to install both?
@Abhishek Rawal • 03 Nov, 2013
rukawa
I installed the intel C++ composer XE, because I'm only having C programs, why do I have to install both?
Because back then I had 😛
Anyways leave that.

have you installed build-essentials ?
apt-get install build-essential
@rukawa • 03 Nov, 2013
Abhishek Rawal
Because back then I had 😛
Anyways leave that.

have you installed build-essentials ?
apt-get install build-essential
😀 , Yes I have, and I followed these steps to install the icc compiler :
https://software.intel.com/en-us/articles/using-intel-compilers-for-linux-with-ubuntu
@Abhishek Rawal • 03 Nov, 2013 So you're using 12.04 LTS & Intel 13.0 ICC, I assume.
You followed this, right ?
November 2012: Ubuntu 12.xx and Intel 13.0.0.079 (Composer XE 2013 initial release) URGENT, Installation will fail without a manual change

Ubu 12.0x changed the link for /bin/sh from /bin/bash to /bin/dash. Intel installation scripts for 13.0.0.079 reference /bin/sh BUT assume/require this is bourne or bash (sh or bash) but are NOT compatible with dash. To get around this problem, do the following before trying to install the Intel compiler:

As root user:

mv /bin/sh /bin/sh.orig
ln -s /bin/bash /bin/sh

Read the following information to continue to configure your system BEFORE you attempt an installation.
Following installation you are free to revert back to linking /bin/sh to /bin/dash if you so desire.
@rukawa • 03 Nov, 2013
Abhishek Rawal
So you're using 12.04 LTS & Intel 13.0 ICC, I assume.
You followed this, right ?
Yes I followed the these steps, except that I didn't extract the archive in /tmp, I exctracted it a directory that I created : Documents/icc
@Abhishek Rawal • 03 Nov, 2013 Okay we are now few steps away.
Show me output of (one by one)
 ls /opt/intel 
 ls /opt/intel/Compiler 
@rukawa • 03 Nov, 2013
Abhishek Rawal
Okay we are now few steps away.
Show me output of (one by one)
 ls /opt/intel 
 ls /opt/intel/Compiler 

rukawa@ruka:/$ ls /opt/intel
bin composer_xe_2013_sp1.0.080 ipp licenses tbb
composerxe include ism man
composer_xe_2013_sp1 intel_sdp_products.db lib mkl
rukawa@ruka:/$

I have no directory called Compiler, if you're meaning the name of the compiler I installed, then :

rukawa@ruka:/$ ls /opt/intel/composer_xe_2013_sp1.0.080
bin Documentation ipp pkg_bin uninstall
compiler eclipse_support man Samples uninstall_GUI.sh
debugger foldermap.sc.xml mkl tbb uninstall.sh
rukawa@ruka:/$
@Abhishek Rawal • 03 Nov, 2013
rukawa@ruka:/$ ls /opt/intel/composer_xe_2013_sp1.0.080
bin Documentation ipp pkg_bin uninstall
compiler eclipse_support man Samples uninstall_GUI.sh
debugger foldermap.sc.xml mkl tbb uninstall.sh
rukawa@ruka:/$
There I see compiler!
ls /opt/intel/composer_xe_2013_sp1.0.080/compiler 
@rukawa • 03 Nov, 2013
Abhishek Rawal
There I see compiler!
ls /opt/intel/composer_xe_2013_sp1.0.080/compiler 
rukawa@ruka:/$ ls /opt/intel/composer_xe_2013_sp1.0.080/compiler
include lib perf_headers
rukawa@ruka:/$
@Abhishek Rawal • 03 Nov, 2013
rukawa
rukawa@ruka:/$ ls /opt/intel/composer_xe_2013_sp1.0.080/compiler
include lib perf_headers
rukawa@ruka:/$
It perfectly seems like path of compiler.
Still you have to do bit of work on your own to assure that it's compiler only. Check each & every file under /opt/intel & locate compiler.

(I am quite sure that the above directory is compiler, but do cross-check too)
Once compiler is located, open .bashrc
add these codes in the end
 if [ -d "path of compiler" ] ; then
          PATH="path of compiler:$PATH"
fi 
then run ~/.bashrc
@Abhishek Rawal • 03 Nov, 2013 @rukawa locate /bin inside /opt/intel/composer_xe_2013_sp1.0.080/compiler
There must be /bin somewhere. Most prolly under include or lib folder.
@rukawa • 03 Nov, 2013
Abhishek Rawal
@rukawa locate /bin inside /opt/intel/composer_xe_2013_sp1.0.080/compiler
There must be /bin somewhere. Most prolly under include or lib folder.

I looked for /bin but it's not inside compiler, in fact , the /opt/intel/composer_xe_2013_sp1.0.080 directory has a /bin and a /compiler, but there's not /bin inside /compiler, I checked all the directories inside /compiler.
As for the code
if [ -d "path of compiler" ] ; then
PATH="path of compiler:$PATH"
fi
I deleted the export line that you showed me at the beginning, and I wrote the following at the end of the .bashrc file :
if [ -d /opt/intel/composer_xe_2013_sp1.0.080/compiler ] ; then
PATH="/opt/intel/composer_xe_2013_sp1.0.080/compiler/:$PATH"
fi

I saved the .bashrc file and executed the command :
source ~/.bashrc

then I tried to compile my .c file using :
icc test1.c
but I'm still getting the message :
icc : command not found
@Abhishek Rawal • 03 Nov, 2013 Add
 if [ -d "/opt/intel/bin" ] ; then
PATH="/opt/intel/bin:$PATH"
fi
run bashrc

If you attach screenshot of every directory it will help me to visualise.
@rukawa • 03 Nov, 2013 @Abhishek Rawal, I've just bumped into this article : https://software.intel.com/sites/products/documentation/doclib/iss/2013/top/embedded_gsdoc_l.htm,
it's about setting up the environment variables before starting with the C++ compiler, my problem is that I don't have the iccvars.sh file, I've looked for it everywhere in tha /opt/intel directory.
@Abhishek Rawal • 03 Nov, 2013 Try re-installing the compiler, but remember one thing.
During setup when it asks :
1) start installation now
2) change directory (or something like that)
3) Change components to install

select the third one, because it will install all components. and none of libs will be missing.
As intel wiki says, extract installer in /tmp; so it's better to do as it says. This might be the problem too.
@rukawa • 03 Nov, 2013
Abhishek Rawal
Try re-installing the compiler, but remember one thing.
During setup when it asks :
1) start installation now
2) change directory (or something like that)
3) Change components to install

select the third one, because it will install all components. and none of libs will be missing.
As intel wiki says, extract installer in /tmp; so it's better to do as it says. This might be the problem too.
Ok I'll do it. Thank you very very much for your help 😀
@Abhishek Rawal • 03 Nov, 2013 • 1 like
rukawa
Ok I'll do it. Thank you very very much for your help 😀
I am quite disappointed as I couldn't help you to compile, because it's very easy shit & I have done this few timesback then =/
I am off now, I'll be coming online back tomorrow, If you have no problem then we can ping eachother using teamviewer , so I can solve the problem easily.
Goodluck, I hope your problem gets solve asap.
@rukawa • 03 Nov, 2013 • 1 like
Abhishek Rawal
I am quite disappointed as I couldn't help you to compile, because it's very easy shit & I have done this few timesback then =/
I am off now, I'll be coming online back tomorrow, If you have no problem then we can ping eachother using teamviewer , so I can solve the problem easily.
Goodluck,I hope your problem gets solve asap.
At last! it got solved...
Here what I did:
1- I uninstalled the compiler
2- I followed this : https://software.intel.com/en-us/articles/using-intel-compilers-for-linux-with-ubuntu to installl it again
The thing is, in my first trial I haven't done this :

mv /bin/sh /bin/sh.orig
ln -s /bin/bash /bin/sh
and I haven't extracted the archive in /tmp,
Now I did as the article said without changing anything

3 - After the completion of the installation, I composed this command :
source <install-dir>/bin/iccvars.sh <arg>
and replaced <install-dir> by : /opt/intel/composer_2013_sp1.0.080 (because that's where I have the intel compiler installed) and <arg> by : intel64 (because I have an amd64)
(I got the command from the following article : https://software.intel.com/sites/products/documentation/doclib/iss/2013/top/embedded_gsdoc_l.htm)

4- I read this thread : https://software.intel.com/en-us/forums/topic/342515
and composed the following commands one after the other:
source /opt/intel/bin/iccvars.sh intel64
source /opt/intel/bin/compilervars.sh intel64
source /opt/intel/composer_xe_2013_sp1.0.080/bin/iccvars.sh intel64
source /opt/intel/composer_xe_2013_sp1.0.080/bin/compilervars.sh intel64
Now when I type :
icc --version
I get this result :
icc (ICC) 14.0.0 20130728
Copyright (C) 1985-2013 Intel Corporation. All rights reserved.

I took quite a while!
@Abhishek Rawal • 04 Nov, 2013 @rukawa You might love to read this compilers benchmarking article : https://slashdot.org/topic/bi/speed-test-comparing-intel-c-gnu-c-and-llvm-clang-compilers/
@rukawa • 05 Nov, 2013
Abhishek Rawal
@rukawa You might love to read this compilers benchmarking article : https://slashdot.org/topic/bi/speed-test-comparing-intel-c-gnu-c-and-llvm-clang-compilers/
Thanks ! I'm currently working on an assignment in which I have to do benchmarking 😀
@Abhishek Rawal • 05 Nov, 2013
rukawa
Thanks ! I'm currently working on an assignment in which I have to do benchmarking 😀
I understood that (because why would anyone install icc when gcc is already been shipped in Linux ?)
Are you using phoronix suite for benchmarking ?
I am quite interested in GCC versus Clang. Do post the result here, I would love to have discussion on that 😀
@rukawa • 06 Nov, 2013
Abhishek Rawal
I understood that (because why would anyone install icc when gcc is already been shipped in Linux ?)
Are you using phoronix suite for benchmarking ?
I am quite interested in GCC versus Clang. Do post the result here, I would love to have discussion on that 😀
Ok, I'll finish some work first because I'm in a bit of a hurry and I'll post the result
@Abhishek Rawal • 06 Nov, 2013 @rukawa No hurry,buddy. Good luck for your project 😀
@rukawa • 08 Nov, 2013
Abhishek Rawal
@rukawa No hurry,buddy. Good luck for your project 😀
In my assignment, I had to compare the execution time of programs implemented :
1- without OpenMP
2 - using OpenMP
I only used Icc because it was required. (I could have done the same thing using gcc)
(To get sarted on openMP https://computing.llnl.gov/tutorials/openMP/)
1 - the mandelbrot fracatal:
(I you want to get an idea about what it is you can go to http https://en.wikipedia.org/wiki/Mandelbrot_set)
int mandelbrot (float a, float b, int max_iter)
{
      int iter = 0;
      float x=0, y=0;
    while(( iter < max_iter ) && ( x*x + y*y <= 4.0) )
    {
        x = x*x - y*y + a;
        y = 2*x*y + b;
         iter++;
    }
   return iter;
}

Now, that's a simple program, but one has to be careful when adding the openmp pragma because a segmentation fault can easily araise (and that's what happened to me)
int mandelbrot (float a, float b, int max_iter)
{
      int iter = 0;
      float x=0, y=0;
      [B]omp_set_num_threads([number of threads]);  [/B]
      [B]#pragma omp parallel for private(iter,a,b) schedule([scheduling type], [chunksize ])[/B]  
     while(( iter < max_iter ) && ( x*x + y*y <= 4.0) )
      {
          x = x*x - y*y + a;
          y = 2*x*y + b;
          iter++;
      }
      return iter;
}
I compared the execution times when choosing static and dynamic scheduling (in both scheduling patterns I gave the threads the same number of iterations to process).
The result is : the bigger the numbre of threads id, the faster the program is executed. I'm not sur whether it's correct or not, but it seems to me logical. I read somewhere that depending on the number of cores of the computer, there's an optimal combination of the number of threads, the scheduling policy and the chunk size.
I have a dual core machine, and the optimal combination in my case was:
number of threads = 8
scheduling policy = dynamic
chunk size = max_iter/number of threads
so in more concrete words :
for max_iter = 256 (to have 256 levels of gray), I wrote:
[....]
omp_set_num_threads(8); 
#pragma omp parallel for private(iter,a,b) schedule(dynamic, 64)
[....]
I didn't try for more than 8 threads, but maybe I could have had a faster program if I had tried it.
As for the best scheduling policy, in this case it's dynamic scheduling. Logical, because the amount of work that each iteration contains depends on the value of the exiting iteration.

I have though some questions on which I've been ruminating, since I got these results:
-Why would a lower number of threads give better results?
-When I didn't use the private(iter,a,b) clause I kept getting a segmentation fault, bur why?

2-Calculation of pi
We have
There are 2 formulas to implement
Capture du 2013-11-05 22:25:19
Capture du 2013-11-05 22:41:09

The second one gave better results in terms of precision and time of execution, BUT:
I couldn't implement the OpenMP at all! I kept getting the segmentation fault no matter how I tried!
here's my program:
double integrale(int64 n)
{
  double pi = 0.0;
  int i; double x,sum; int id;
  double step = 1.0/(double)n;
omp_set_num_threads(2);
  #pragma omp parallel private(x,sum)
  {
       id = omp_get_thread_num();
       for(i=id,sum=0.0;i<n;i=i+2)
      {
         x = ((double)i-0.5)*step;
         sum += 4.0/(1.0+x*x);
      }
  #pragma omp critical
    pi += sum*step;
  }
  retrun pi;
}
What could be that created the problem?
8.2k views

Related Posts

@Ankita Katdare · May 27, 2013

Nokia India has revealed on its website that the company's new flagship phone Lumia 925 is 'coming soon'. Unveiled earlier this month, Nokia Lumia 925 is the smartphone with the...
8.3k views

@swapnil yeole · Dec 2, 2013

Hello, I want to get a broadband connection in Gananjay Society area of Kothrud in Pune. I have seen plans from many ISP's and talked to many people in area...
4.2k views

@Ankita Katdare · Dec 13, 2013

DSK Motowheels have launched in India a new special edition superbike called the Hyosung GT250 R LE. Hyosung's tag line - "Made in Korea, Ridden by the world" is evident...
4k views

@Ankita Katdare · Jan 9, 2016

BHEL or Bharat Heavy Electricals Limited is the a power plant equipment manufacturer under Government of India. Their manufacturing facilities (factories) are located in various cities across India, including -Jagdishpur,...
74.5k views

@Ankita Katdare · Sep 12, 2013

This year has been great for Celkon. With frequent launches of its new smartphones, the Indian mobile manufacturere has been a part of the news headlines for multiple times over...
3.4k views