views:

52

answers:

2

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
+1  A: 

Try setting the environmental variable CC to gcc.

csh:  setenv CC gcc
bash: export CC=gcc
sharth
`Makefile` has `CC = mpicc` and `CFLAGS += -DMPI`. Otherwise, I do not get `mpi` interface. Is it correct?
Andrey
@Andrei: Those aren't environmental variables. You want those as well as setting the environmental variables I suggested above.
sharth
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?
Andrey
Bingo, now it works. You helped me to realize that `OMPI_CC` should be set outside `Makefile`
Andrey
@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.
sharth
@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?
Andrey