Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#4 cannot compile gaul with mpi (mpich) support

open
None
5
2009-04-08
2007-04-20
Anonymous
No

root@etch:/usr/src/gaul-devel-0.1850-0# ./configure --enable-mpi

(...)
checking whether to use OpenMP... no
checking whether to use MPI... yes
checking for LAM-MPI... checking for MPI_Init in -lmpi... no
yes
configure: error: Unable to locate an installed MPI implementation. Manually set the MPIFLAGS and MPILIBS environment variables
./configure: line 19634: exit: or: numeric argument required
./configure: line 19634: exit: or: numeric argument required

I have mpich installed here (debian etch)

In the configure the MPIFLAGS and MPILIBS environment variables are set for mpich like

MPIFLAGS="-DUSE_STDARG -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_UNISTD_H=1 -DHAVE_STDARG_H=1 -DUSE_STDARG=1 -DMALLOC_RET_VOID=1"
MPILIBS="-lmpich"

However setting these variables before configure gives the error

(...)
checking whether to use OpenMP... no
checking whether to use MPI... yes
checking for MPI_Init in -lm... no
configure: error: Unable to compile with specified MPI implementation. Check MPIFLAGS and MPILIBS environment variables
./configure: line 19437: exit: or: numeric argument required
./configure: line 19437: exit: or: numeric argument required

After some research, I found the solution

MPILIBS="-lmpi"

now configure works properly.

But this is not all...compilation fails after that

root@etch:/usr/src/gaul-devel-0.1850-0# make

(...)

if /bin/sh ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../util/gaul -g -O2 -Wall -MT timer_util.lo -MD -MP -MF ".deps/timer_util.Tpo" -c -o timer_util.lo timer_util.c; \ then mv -f ".deps/timer_util.Tpo" ".deps/timer_util.Plo"; else rm -f ".deps/timer_util.Tpo"; exit 1; fi
gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../util/gaul -g -O2 -Wall -MT timer_util.lo -MD -MP -MF .deps/timer_util.Tpo -c timer_util.c -fPIC -DPIC -o .libs/timer_util.o
In file included from gaul/timer_util.h:42,
from timer_util.c:38:
./gaul/log_util.h:45:17: error: mpi.h: No such file or directory
make[2]: ** [timer_util.lo] Erro 1
make[2]: Saindo do diretório `/usr/src/gaul-devel-0.1850-0/util'
make[1]: ** [all-recursive] Erro 1
make[1]: Saindo do diretório `/usr/src/gaul-devel-0.1850-0'
make: ** [all] Erro 2

Looking at util/gaul/log_util.h, line 45

#ifdef HAVE_MPI
#include <mpi.h>
#endif

this must be changed to

#ifdef HAVE_MPI
#include <mpi/mpi.h>
#endif

root@etch:/usr/src/gaul-devel-0.1850-0# make

(...)

if /bin/sh ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../util/gaul -I../util -I../util -g -O2 -Wall -MT ga_bitstring.lo -MD -MP -MF ".deps/ga_bitstring.Tpo" -c -o ga_bitstring.lo ga_bitstring.c; \ then mv -f ".deps/ga_bitstring.Tpo" ".deps/ga_bitstring.Plo"; else rm -f ".deps/ga_bitstring.Tpo"; exit 1; fi
mkdir .libs
gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../util/gaul -I../util -I../util -g -O2 -Wall -MT ga_bitstring.lo -MD -MP -MF .deps/ga_bitstring.Tpo -c ga_bitstring.c -fPIC -DPIC -o .libs/ga_bitstring.o
In file included from ./gaul/ga_core.h:105,
from ./gaul.h:632,
from gaul/ga_bitstring.h:38,
from ga_bitstring.c:41:
./gaul/ga_optim.h:42:17: error: mpi.h: No such file or directory
make[2]: ** [ga_bitstring.lo] Erro 1
make[2]: Saindo do diretório `/usr/src/gaul-devel-0.1850-0/src'
make[1]: ** [all-recursive] Erro 1
make[1]: Saindo do diretório `/usr/src/gaul-devel-0.1850-0'
make: ** [all] Erro 2

Looking at file src/gaul/ga_optim.h, line 42

#ifdef HAVE_MPI
#include <mpi.h>
#endif

this must also be changed to

#ifdef HAVE_MPI
#include <mpi/mpi.h>
#endif

wait...this is not all...

now compilation fails at
if /bin/sh ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../util/gaul -I../util -I../util -g -O2 -Wall -MT ga_core.lo -MD -MP -MF ".deps/ga_core.Tpo" -c -o ga_core.lo ga_core.c; \ then mv -f ".deps/ga_core.Tpo" ".deps/ga_core.Plo"; else rm -f ".deps/ga_core.Tpo"; exit 1; fi
gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../util/gaul -I../util -I../util -g -O2 -Wall -MT ga_core.lo -MD -MP -MF .deps/ga_core.Tpo -c ga_core.c -fPIC -DPIC -o .libs/ga_core.o
ga_core.c: In function 'ga_population_clone':
ga_core.c:700: warning: ignoring #pragma omp parallel
ga_core.c: In function 'gaul_population_fill':
ga_core.c:872: warning: ignoring #pragma omp parallel
ga_core.c: In function 'ga_population_score_and_sort':
ga_core.c:1076: warning: ignoring #pragma omp parallel
ga_core.c: In function 'ga_population_append_receive':
ga_core.c:2056: error: expected identifier or '(' before '=' token
ga_core.c:2057: error: expected ')' before '->' token
ga_core.c:2057: error: expected expression before ',' token
ga_core.c:2059: error: expected expression before 'entity'
ga_core.c:2059: error: too few arguments to function 'pop->chromosome_from_bytes'
ga_core.c:2030: warning: unused variable 'this_entity'
make[2]: ** [ga_core.lo] Erro 1
make[2]: Saindo do diretório `/usr/src/gaul-devel-0.1850-0/src'
make[1]: ** [all-recursive] Erro 1
make[1]: Saindo do diretório `/usr/src/gaul-devel-0.1850-0'
make: ** [all] Erro 2

Looking at src/ga_core.c, line 2056

for (i=0; i<num_to_recv; i++)
{
entity = ga_get_free_entity(pop);
mpi_receive(&(entity->fitness), 1, MPI_DOUBLE, src_node, GA_TAG_ENTITYFITNESS);
mpi_receive(buffer, len, MPI_BYTE, src_node, GA_TAG_ENTITYCHROMOSOME);
pop->chromosome_from_bytes(pop, entity, buffer);
/* printf("DEBUG: Node %d received entity %d/%d (%d) with fitness %f\n",
mpi_get_rank(), i, num_to_recv, pop->size, entity->fitness);
*/

entity must be changed to this_entity in lines 2056,2057,2059 and 2061 (if you want the debug printf corrected too :-) )

for (i=0; i<num_to_recv; i++)
{
this_entity = ga_get_free_entity(pop);
mpi_receive(&(this_entity->fitness), 1, MPI_DOUBLE, src_node, GA_TAG_ENTITYFITNESS);
mpi_receive(buffer, len, MPI_BYTE, src_node, GA_TAG_ENTITYCHROMOSOME);
pop->chromosome_from_bytes(pop, this_entity, buffer);
/* printf("DEBUG: Node %d received entity %d/%d (%d) with fitness %f\n",
mpi_get_rank(), i, num_to_recv, pop->size, this_entity->fitness);
*/
}

Now compilation works fine, despite some warnings :-)

I hope it helps.

rafael at fis dot unb dot br

Discussion

  • Stewart Adcock
    Stewart Adcock
    2009-04-08

    • assigned_to: nobody --> stewartadcock