8

I have a C-code for parallel computing written for gcc, and I want to compile it on a cluster, which apparently uses icc via mpicc. Correcting the code to be icc-friendly seems to be too time-demanding, so I wonder if I can ask OpenMPI to use gcc instead. I don't have the admin rights on that cluster, and I would actually prefer to do not mess the original configuration.

If it is not possible to set in e.g. Makefile, then I could hopefully compile OpenMPI in my home directory, but I need some guidance in what must be done after that. Could you help me?


UPDATE1

The Makefile contains

CC = mpicc
CFLAGS += -DMPI

And here are some OpenMPI files

$ which mpicc
/usr/bin/mpicc

lrwxr-xr-x  /usr/bin/mpicc -> opal_wrapper
-rwxr-xr-x  /usr/bin/opal_wrapper

Let me know, if I can provide you more information.


UPDATE2

With the help of Jeff, I was able to find OpenMPI settings for mpicc

$ more /usr/local/share/openmpi/mpicc-wrapper-data.txt 
project=Open MPI
project_short=OMPI
version=1.1.4
language=C
compiler_env=CC
compiler_flags_env=CFLAGS
compiler=icc
extra_includes= openmpi
preprocessor_flags= 
compiler_flags=-pthread 
linker_flags=    
libs=-lmpi -lorte -lopal   -ldl   -Wl,--export-dynamic -lnsl -lutil -ldl 
required_file=

However, I do not have rights to edit this file, and OPMI_CC = gcc doesn't change compiler.


UPDATE3

Environmental variable CC = gcc doesn't help

$ export CC=gcc
$ echo $CC
gcc
$ make clean $$ make
...icc:...errors

UPDATE4

...but export OMPI_CC=gcc does finally help (thanks to sharth). I should one day remember that these are different things...

Despite that the binary was created, I got the following bye-bye message

/opt/intel/fce/9.1.036/lib/libimf.so: warning: warning: feupdateenv is not implemented and will always fail
Community
  • 1
  • 1
Andrei
  • 10,918
  • 12
  • 76
  • 110

2 Answers2

2

Try setting the environmental variable CC to gcc.

csh:  setenv CC gcc
bash: export CC=gcc
Bill Lynch
  • 80,138
  • 16
  • 128
  • 173
  • `Makefile` has `CC = mpicc` and `CFLAGS += -DMPI`. Otherwise, I do not get `mpi` interface. Is it correct? – Andrei Jul 28 '10 at 13:58
  • 1
    @Andrei: Those aren't environmental variables. You want those as well as setting the environmental variables I suggested above. – Bill Lynch Jul 28 '10 at 15:05
  • OK, I see my mistake. I have just tried as you suggest, and it is still `icc`. May be you can have a look at the page suggested by Jeff? Do I do as it says? – Andrei Jul 28 '10 at 15:15
  • 1
    Bingo, now it works. You helped me to realize that `OMPI_CC` should be set outside `Makefile` – Andrei Jul 28 '10 at 15:20
  • @Andrei: At the time I changed the answer, you had given the checkmark to my answer. If I was going to have the "right answer here" mark, then I figured it should at least be the right answer. – Bill Lynch Jul 29 '10 at 13:47
  • @sharth: Yes, I understand your responsibility (sorry, if I was pushing you), but not the way you do corrections. Do you see what I mean? – Andrei Jul 29 '10 at 14:03