Debian の MPI 実装に関するメモ

  • MPI とか全く知らないので、MPIそのものについては書いてません。
  • 主にSH4 向けのメモです。

実装メモ

  • アーキテクチャで使われる MPI は /usr/share/mpi-default-dev/debian_defaults に書かれている。

    # Default MPI implementation on this arch
    ARCH_DEFAULT_MPI_IMPL=mpich2
    

    とか。これはmpi-default-devパッケージで提供されていて、ソースパッケージはmpi-defaults。

     $ readlink /etc/alternatives/mpi

と alternatives をみて、何を使っているのかチェックしている。
  • sh4 はopenmpiが サポートされていない。
  • openmpi サポートしてない場合は mpich2 とか。

既存の問題

  • sh4 のFTBFS

    make[3]: Leaving directory `/build/buildd-mpich2_1.4.1-4-sh4-XMu2UF/mpich2-1.4.1/src'
    make[2]: Leaving directory `/build/buildd-mpich2_1.4.1-4-sh4-XMu2UF/mpich2-1.4.1/src'
    make lib/libmpich.so
    make[2]: Entering directory `/build/buildd-mpich2_1.4.1-4-sh4-XMu2UF/mpich2-1.4.1'
    (cd lib && /build/buildd-mpich2_1.4.1-4-sh4-XMu2UF/mpich2-1.4.1/src/util/createshlib --mode=link  -version-info "3:2" -o libmpich.la  -rpath /usr/lib -L.   -ldflags " -Wl,-z,defs" -lrt -lpthread   -lmpl)  
    .tmp/ch3_isend.o: In function `OPA_load_ptr':
    /build/buildd-mpich2_1.4.1-4-sh4-XMu2UF/mpich2-1.4.1/src/openpa/src/primitives/opa_by_lock.h:79: undefined reference to `OPA_emulation_lock'
    .tmp/ch3_isend.o: In function `OPA_store_ptr':
    /build/buildd-mpich2_1.4.1-4-sh4-XMu2UF/mpich2-1.4.1/src/openpa/src/primitives/opa_by_lock.h:86: undefined reference to `OPA_emulation_lock'
    .tmp/ch3_isend.o: In function `MPIDI_CH3_iSend':
    /build/buildd-mpich2_1.4.1-4-sh4-XMu2UF/mpich2-1.4.1/src/mpid/ch3/channels/nemesis/src/ch3_isend.c:30: undefined reference to `OPA_emulation_lock'
    .tmp/ch3_isend.o: In function `OPA_incr_int':
    /build/buildd-mpich2_1.4.1-4-sh4-XMu2UF/mpich2-1.4.1/src/mpid/ch3/channels/nemesis/nemesis/include/mpid_nem_inline.h:121: undefined reference to `OPA_emulation_lock'
    .tmp/ch3_isend.o: In function `MPID_NEM_CAS_REL_NULL':
    /build/buildd-mpich2_1.4.1-4-sh4-XMu2UF/mpich2-1.4.1/src/mpid/ch3/channels/nemesis/nemesis/include/mpid_nem_queue.h:71: undefined reference to `OPA_emulation_lock'
    .tmp/bsendutil.o:/build/buildd-mpich2_1.4.1-4-sh4-XMu2UF/mpich2-1.4.1/src/mpi/pt2pt/bsendutil.c:471: more undefined references to `OPA_emulation_lock' follow
    .tmp/mpid_nem_alloc.o: In function `MPIDI_CH3I_Seg_commit':
    /build/buildd-mpich2_1.4.1-4-sh4-XMu2UF/mpich2-1.4.1/src/mpid/ch3/channels/nemesis/nemesis/src/mpid_nem_alloc.c:358: undefined reference to `OPA_Interprocess_lock_init'
    /build/buildd-mpich2_1.4.1-4-sh4-XMu2UF/mpich2-1.4.1/src/mpid/ch3/channels/nemesis/nemesis/src/mpid_nem_alloc.c:320: undefined reference to `OPA_emulation_lock'
    /build/buildd-mpich2_1.4.1-4-sh4-XMu2UF/mpich2-1.4.1/src/mpid/ch3/channels/nemesis/nemesis/src/mpid_nem_alloc.c:375: undefined reference to `OPA_Interprocess_lock_init'
    .tmp/mpid_nem_alloc.o: In function `check_alloc':
    /build/buildd-mpich2_1.4.1-4-sh4-XMu2UF/mpich2-1.4.1/src/mpid/ch3/channels/nemesis/nemesis/src/mpid_nem_alloc.c:507: undefined reference to `OPA_Interprocess_lock_init'
    /build/buildd-mpich2_1.4.1-4-sh4-XMu2UF/mpich2-1.4.1/src/mpid/ch3/channels/nemesis/nemesis/src/mpid_nem_alloc.c:507: undefined reference to `OPA_emulation_lock'
    .tmp/mpid_nem_barrier.o: In function `MPID_nem_barrier_init':
    /build/buildd-mpich2_1.4.1-4-sh4-XMu2UF/mpich2-1.4.1/src/mpid/ch3/channels/nemesis/nemesis/src/mpid_nem_barrier.c:35: undefined reference to `OPA_emulation_lock'
    .tmp/mpid_nem_barrier.o: In function `OPA_store_int':
    /build/buildd-mpich2_1.4.1-4-sh4-XMu2UF/mpich2-1.4.1/src/openpa/src/primitives/opa_by_lock.h:69: undefined reference to `OPA_emulation_lock'
    .tmp/mpid_nem_init.o: In function `MPID_nem_queue_init':
    /build/buildd-mpich2_1.4.1-4-sh4-XMu2UF/mpich2-1.4.1/src/mpid/ch3/channels/nemesis/nemesis/src/../include/mpid_nem_queue.h:53: undefined reference to `OPA_emulation_lock'
    .tmp/mpid_nem_init.o: In function `MPID_nem_init':
    /build/buildd-mpich2_1.4.1-4-sh4-XMu2UF/mpich2-1.4.1/src/mpid/ch3/channels/nemesis/nemesis/src/mpid_nem_init.c:51: undefined reference to `OPA_emulation_lock'
    .tmp/mpid_nem_lmt.o:/build/buildd-mpich2_1.4.1-4-sh4-XMu2UF/mpich2-1.4.1/src/mpid/ch3/channels/nemesis/nemesis/src/mpid_nem_lmt.c:232: more undefined references to `OPA_emulation_lock' follow
    
  • src/openpa/src/primitives/opa_by_lock.h の79 行

    72 static _opa_inline void *OPA_load_ptr(_opa_const OPA_ptr_t *ptr)
    73 {
    74     int *retval;
    75     OPA_IPC_SINGLE_CS_ENTER("atomic_add");
    76     retval = ptr->v;
    77     OPA_IPC_SINGLE_CS_EXIT("atomic_add");
    78     return retval;
    79 }
    
  • OPA_IPC_SINGLE_CS_EXIT と OPA_IPC_SINGLE_CS_ENTER は src/openpa/src/primitives/opa_by_lock.h の上のほうで定義。

    19 /* FIXME these make less sense now that OPA is not inside of MPICH2.  Is there a
    20    simpler name/scheme that could be used here instead? [goodell@ 2009-02-19] */
    21 #define OPA_IPC_SINGLE_CS_ENTER(msg)          \
    22     do {                                        \
    23         OPA_assert(OPA_emulation_lock);    \
    24         pthread_mutex_lock(OPA_emulation_lock);     \
    25     } while (0)
    26 
    27 #define OPA_IPC_SINGLE_CS_EXIT(msg)           \
    28     do {                                        \
    29         OPA_assert(OPA_emulation_lock);    \
    30         pthread_mutex_unlock(OPA_emulation_lock);   \
    31     } while (0)
    32