[Pkg-openmpi-maintainers] Bug#732027: openmpi: support for mips, mipsel, mips64, and mips64el

Jurica Stanojkovic Jurica.Stanojkovic at imgtec.com
Thu Dec 12 16:34:22 UTC 2013


Package: openmpi
Version: 1.6.5-5
Tags: patch
Severity: important


Hello,


I have attached patches that enable building of package openmpi_1.6.5-5 
on following architectures: mips, mipsel, mips64, mips64el.

First, these architectures have to be supported, added to debian/control file.
File debian/control is patched with the following patch:

diff -upNr openmpi-1.6.5-orig/debian/control openmpi-1.6.5/debian/control
--- openmpi-1.6.5-orig/debian/control   2013-08-28 06:52:24.000000000 +0000
+++ openmpi-1.6.5/debian/control        2013-12-11 16:38:26.000000000 +0000
@@ -16,7 +16,7 @@ Vcs-Svn: svn://svn.debian.org/svn/pkg-op
 Vcs-Browser: http://svn.debian.org/wsvn/pkg-openmpi/openmpi/trunk/

 Package: openmpi-bin
-Architecture: alpha amd64 armel armhf i386 ia64 powerpc powerpcspe ppc64 sparc sparc64 kfreebsd-i386 kfreebsd-amd64 hurd-i386
+Architecture: alpha amd64 armel armhf i386 ia64 powerpc powerpcspe ppc64 sparc sparc64 kfreebsd-i386 kfreebsd-amd64 hurd-i386 mips mipsel mips64 mips64el
 Depends: ${shlibs:Depends}, ${misc:Depends}, openmpi-common (= ${source:Version})
 Conflicts: openmpi-bin
 Suggests: gfortran, openmpi-checkpoint [amd64 armel armhf i386 powerpc]
@@ -45,7 +45,7 @@ Description: high performance message pa

 Package: libopenmpi-dev
 Section: libdevel
-Architecture: alpha amd64 armel armhf i386 ia64 powerpc powerpcspe ppc64 sparc sparc64 kfreebsd-i386 kfreebsd-amd64 hurd-i386
+Architecture: alpha amd64 armel armhf i386 ia64 powerpc powerpcspe ppc64 sparc sparc64 kfreebsd-i386 kfreebsd-amd64 hurd-i386 mips mipsel mips64 mips64el
 Depends: ${shlibs:Depends}, ${misc:Depends}, libopenmpi1.6 (= ${binary:Version}), openmpi-common (= ${source:Version}), libibverbs-dev [!kfreebsd-i386 !kfreebsd-amd64 !hurd-i386], libhwloc-dev
 Conflicts: openmpi-dev, libopenmpi-dev, openmpi-bin (<= 1.2.4-0)
 Description: high performance message passing library -- header files
@@ -60,7 +60,7 @@ Description: high performance message pa

 Package: libopenmpi1.6
 Section: libs
-Architecture: alpha amd64 armel armhf i386 ia64 powerpc powerpcspe ppc64 sparc sparc64 kfreebsd-i386 kfreebsd-amd64 hurd-i386
+Architecture: alpha amd64 armel armhf i386 ia64 powerpc powerpcspe ppc64 sparc sparc64 kfreebsd-i386 kfreebsd-amd64 hurd-i386 mips mipsel mips64 mips64el
 Depends: ${shlibs:Depends}, ${misc:Depends}
 Conflicts: openmpi-libs0, libopenmpi1, libopenmpi1.3, libopenmpi2
 Description: high performance message passing library -- shared library
@@ -104,7 +104,7 @@ Description: high performance message pa

 Package: libopenmpi1.6-dbg
 Section: debug
-Architecture: alpha amd64 armel armhf i386 ia64 powerpc powerpcspe ppc64 sparc sparc64 kfreebsd-i386 kfreebsd-amd64 hurd-i386
+Architecture: alpha amd64 armel armhf i386 ia64 powerpc powerpcspe ppc64 sparc sparc64 kfreebsd-i386 kfreebsd-amd64 hurd-i386 mips mipsel mips64 mips64el
 Depends: ${misc:Depends}, openmpi-bin (= ${binary:Version}), libopenmpi1.6 (= ${binary:Version})
 Conflicts: openmpi-dbg, libopenmpi-dbg
 Description: high performance message passing library -- debug library




Next, there are 3 patches (in attachment):
mips-support-upstream-1.7.3.diff             - patches MIPS.asm and mips/atomic.h files to a latest 1.7.3 version of source
mips-support-fix.diff                                 - resolve issue of misinterpretation of assembler code from MIPS.asm  and fix mips64(el) assembler code.                        
mips-detection.diff                                    - support detection of mips, mipsel, mips64, mips64el architectures

Package openmpi for mips, mipsel, mips64 and mips64el is successfully built after applying these patches.


Misinterpretation of assembler code from MIPS.asm explained:

this is part of code from original MIPS.asm source file:
< LEAF(opal_atomic_cmpset_32)
<         .set noreorder
< retry1:
<         ll     $3, 0($4)
<         bne    $3, $5, done1
<         or     $2, $6, 0
<         sc     $2, 0($4)
<         beqz   $2, retry1
< done1:
<         .set reorder
< 
<         xor     $3,$3,$5
<         j       ra
<         sltu    $2,$3,1
< END(opal_atomic_cmpset_32)

this is a part of code from a patched MIPS.asm source file:
< LEAF(opal_atomic_cmpset_32)
<         .set noreorder
< retry1:
<         ll     $3, 0($4)
<         bne    $3, $5, done1
<         or     $2, $6, 0
<         sc     $2, 0($4)
<         beqz   $2, retry1
< done1:
<         .set reorder
< 
<         xor     $3,$3,$5
<         j       ra
<         sltu    $2,$3,1
<         .set reorder
< END(opal_atomic_cmpset_32)

without a patch, resulting code is:
< Dump of assembler code for function opal_atomic_cmpset_32:
<    0x00400ce8 <+0>:     ll      v1,0(a0)
<    0x00400cec <+4>:     bne     v1,a1,0x400cfc <done1>
<    0x00400cf0 <+8>:     ori     v0,a2,0x0
<    0x00400cf4 <+12>:    sc      v0,0(a0)
<    0x00400cf8 <+16>:    beqz    v0,0x400ce8 <opal_atomic_cmpset_32>
<    0x00400cfc <+0>:     xor     v1,v1,a1
< => 0x00400d00 <+4>:     jr      ra
<    0x00400d04 <+8>:     move    at,at
<    0x00400d08 <+12>:    sltiu   v0,v1,1
< End of assembler dump.

with a patch, resulting code is:
< Dump of assembler code for function opal_atomic_cmpset_32:
<    0x00400ce8 <+0>:     ll      v1,0(a0)
<    0x00400cec <+4>:     bne     v1,a1,0x400cfc <done1>
<    0x00400cf0 <+8>:     ori     v0,a2,0x0
<    0x00400cf4 <+12>:    sc      v0,0(a0)
<    0x00400cf8 <+16>:    beqz    v0,0x400ce8 <opal_atomic_cmpset_32>
<    0x00400cfc <+0>:     xor     v1,v1,a1
< => 0x00400d00 <+4>:     jr      ra
<    0x00400d04 <+8>:     sltiu   v0,v1,1
< End of assembler dump.

Note the lines 0x00400d00 and 0x00400d04.
Without a patch line  "sltiu   v0,v1,1"     is never executed 
because after a line  "jr      ra"
instruction                  "move    at,at"     is inserted in a delay slot of a "jr" instruction. 


We would be happy to provide more information if needed.


Thanks!
Jurica
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mips-support-upstream-1.7.3.diff
Type: text/x-patch
Size: 5144 bytes
Desc: mips-support-upstream-1.7.3.diff
URL: <http://lists.alioth.debian.org/pipermail/pkg-openmpi-maintainers/attachments/20131212/0d39f506/attachment-0009.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mips-support-fix.diff
Type: text/x-patch
Size: 1803 bytes
Desc: mips-support-fix.diff
URL: <http://lists.alioth.debian.org/pipermail/pkg-openmpi-maintainers/attachments/20131212/0d39f506/attachment-0010.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mips-detection.diff
Type: text/x-patch
Size: 1415 bytes
Desc: mips-detection.diff
URL: <http://lists.alioth.debian.org/pipermail/pkg-openmpi-maintainers/attachments/20131212/0d39f506/attachment-0011.bin>


More information about the Pkg-openmpi-maintainers mailing list