summaryrefslogtreecommitdiff
path: root/lib/make/extras/MPI/MPICH
blob: d99b2025fcee5fe9aade34763b86f7ea3f71e12a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#! /bin/sh
# /*@@
#   @file      CUSTOM
#   @date      Wed Jul 21 13:27:07 1999
#   @author    Tom Goodale
#   @desc 
#   
#   @enddesc
#   @version $Header: /mnt/data2/cvs2svn/cvs-repositories/Cactus/lib/make/extras/MPI/MPICH,v 1.8 2000-06-07 15:49:09 tradke Exp $ 
# @@*/


echo "MPICH selected"

# MPICH is pretty configerable itself

# Find the directory.
if test -z "$MPICH_DIR" ; then
   echo "MPICH selected but no MPICH_DIR set... Checking some places"
   CCTK_Search MPICH_DIR "/usr /usr/local /usr/local/mpich /usr/local/packages/mpich /usr/local/apps/mpich" include/mpe.h
    if test -z "$MPICH_DIR" ; then
       echo "Unable to locate the MPICH directory - please set MPICH_DIR"
       exit 2
   fi
fi

# Find the MPICH architecture

if test -z "$MPICH_ARCH" ; then 
  if test -x "$MPICH_DIR/bin/tarch" ; then
    MPICH_ARCH=`$MPICH_DIR/bin/tarch`
    echo "MPICH architecture is $MPICH_ARCH"
  else
    echo "Cannot execute $MPICH_DIR/bin/tarch"
    exit 2
  fi
fi

# Find the MPICH device

if test -z "$MPICH_DEVICE" ; then
   echo "MPICH selected but no MPICH_DEVICE set... Checking for one"
   CCTK_Search MPICH_DEVICE "ch_p4 ch_shmem globus ch_gm" lib $MPICH_DIR/build/$MPICH_ARCH/$MPICH_DEVICE
    if test -z "$MPICH_DEVICE" ; then
       echo "Unable to locate the MPICH device - please set MPICH_DEVICE"
       exit 2
   fi
fi


# Select the device and any special options for it.

case "$MPICH_DEVICE" in
  globus)
   if test -z "$GLOBUS_LIB_DIR" ; then
      echo "GLOBUS selected, but GLOBUS_LIB_DIR not set !"
     exit 2
   fi
   MPICH_DEVICE_LIB_DIR="$GLOBUS_LIB_DIR"
   MPICH_DEVICE_LIBS="globus_duroc_bootstrap globus_duroc_control \
                      globus_duroc_runtime globus_duct_control \
                      globus_duct_runtime globus_gass_cache globus_gass_client \
                      globus_gass_file globus_gass_server \
                      globus_gass_server_ez globus_gram_client \
                      globus_gram_myjob globus_gss globus_gss_assist \
                      globus_hbm_client globus_hbm_datacollector globus_mp \
                      globus_nexus globus_rsl globus_utp globus_dc \
                      globus_common lber ldap ldif netperf"
   if test -n "`echo $GLOBUS_LIB_DIR | grep -i pthreads`" ; then
      MPICH_DEVICE_LIBS="$MPICH_DEVICE_LIBS pthread"
   fi
   ;;
 ch_gm)
   if test -z "$MYRINET_DIR" ; then
      echo "Myrinet device selected but no MYRINET_DIR set... Checking some places"
      CCTK_Search MYRINET_DIR "/usr /usr/local /usr/local/myrinet /usr/local/packages/myrinet /usr/local/apps/myrinet" lib/libgm.a
      if test -z "$MYRINET_DIR" ; then
         echo "Unable to locate the Myrinet directory - please set MYRINET_DIR"
         exit 2
      fi
   fi
   MPICH_DEVICE_LIB_DIR="$MYRINET_DIR/lib"
   MPICH_DEVICE_LIBS="gm"
   ;;
 *)
   MPICH_DEVICE_LIB_DIR=""
   MPICH_DEVICE_LIBS=""
   ;;
esac

# Work out what the MPICH library is called

if test -r "$MPICH_DIR/build/$MPICH_ARCH/$MPICH_DEVICE/lib/libmpi.a" ; then
   MPICH_LIB=mpi
else
   MPICH_LIB=mpich
fi

# Finally set the library lines.

MPI_LIBS="$MPICH_LIB $MPICH_DEVICE_LIBS" 
MPI_LIB_DIRS="$MPICH_DEVICE_LIB_DIR $MPICH_DIR/build/$MPICH_ARCH/$MPICH_DEVICE/lib"
MPI_INC_DIRS="$MPICH_DIR/include $MPICH_DIR/build/$MPICH_ARCH/$MPICH_DEVICE/include"