Bug #746

atomic & mutex implementation for Sun Studio 12 on SPARC

Added by Sergey Klyaus over 9 years ago. Updated over 9 years ago.

Target version:
Affected version - extra info:
Affected version:


When I tried to build Gromacs 4.5.4 on SPARC, I encountered an error (OS: Solaris 10 U9 for SPARC, Compiler Suite: Solaris Studio 12.2, Machine: SPARC Enterprise T5140).

Dummy atomic ops implementation (include/threads_mpi/atomic.h) uses single mutex tMPI_Thread_mutex_t:
/* System mutex used for locking to guarantee atomicity */
static tMPI_Thread_mutex_t tMPI_Atomic_mutex = TMPI_THREAD_MUTEX_INITIALIZER;

while mutexes (include/threads_mpi/threads.h) are using atomic ops:
typedef struct {
tMPI_Atomic_t initialized;
struct tMPI_Mutex* mutex;
} tMPI_Thread_mutex_t;

So i received a lots of compiler errors.

I'd tried to implement atomic ops implementation for SunCC on Solaris using default libc atomic_* functions and ldstub instruction (file attached). Also here are two additional lines for include/threads_mpi/atomic.h:
#elif (defined(sun) || defined (_sun)) && (defined(_sparcv9) || defined(__sparc))
#include "atomic/suncc-sparc.h"

suncc-sparc.h (4.46 KB) suncc-sparc.h Sergey Klyaus, 05/03/2011 05:22 PM
gmx-sol-sparc.patch (8.14 KB) gmx-sol-sparc.patch Sergey Klyaus, 05/10/2011 09:02 AM


#1 Updated by Sergey Klyaus over 9 years ago

Here is complete patch for Solaris on SPARC support.
It contains:
1. Atomic operations implementation
2. CPU clock cycle counters
3. Patch for string2.c (clock_r on solaris has three arguments)
4. Patch for xlate.c (on high optimization levels SunCC treat abuf and _ptr as not aliased memory areas and optimizes while cycle. So we need implicitly "say" that they are aliased

#2 Updated by Sergey Klyaus over 9 years ago

5. rm_t is defined in vnode.h on Solaris, so I renamed Gromacs type to rmm_t

However, perfomance on SPARC is disgusting: on 12-core T5140 (2x 6-Core 1.2Ghz US2+) we have only 6 GFlops

#3 Updated by Sander Pronk over 9 years ago

  • Assignee set to Sander Pronk
  • Affected version - extra info set to 4.5

#4 Updated by Szilárd Páll over 9 years ago

  • Target version changed from 4.5.4 to 4.5.5

#5 Updated by Sander Pronk over 9 years ago

  • Status changed from New to Closed
  • % Done changed from 0 to 100

Hi Sergey,

Thanks for the patches! I've reviewed & added them be included for the next maintenance release.

Note that gromacs is heavily optimized for x86 with SSE and assembly force calculation kernels x86. On a platform where there are no assembly kernels, performance will be slow.

Also available in: Atom PDF