1
1
This commit was SVN r2157.
Этот коммит содержится в:
David Daniel 2004-08-16 01:13:25 +00:00
родитель bfc4b52b8b
Коммит a1688d5b9f
25 изменённых файлов: 83 добавлений и 490 удалений

Просмотреть файл

@ -107,7 +107,7 @@
#include "ompi_config.h"
#endif
#include "include/atomic.h"
#include "include/sys/atomic.h"
/*
* BEGIN_C_DECLS should be used at the beginning of your declarations,

Просмотреть файл

@ -7,7 +7,6 @@ include $(top_srcdir)/config/Makefile.options
SUBDIRS = sys
noinst_HEADERS = \
atomic.h \
constants.h \
ompi.h \
totalview.h \

Просмотреть файл

@ -1,437 +0,0 @@
/*
* $HEADER$
*/
/** @file
*
* Atomic operations.
*
* This API is patterned after the FreeBSD kernel atomic interface
* (which is influenced by Intel's ia64 architecture). The
* FreeBSD interface is documented at
*
* http://www.freebsd.org/cgi/man.cgi?query=atomic&sektion=9
*
* Only the necessary subset of functions are implemented here.
*/
#ifndef OMPI_ATOMIC_H
#define OMPI_ATOMIC_H 1
#include "ompi_config.h"
#if 1
/*
* prototypes
*/
/**
* Atomic compare and set of unsigned 32-bit integer.
*
* @param addr Address of integer.
* @param oldval Comparison value.
* @param newval New value to set if comparision is true.
*
* Pseudo-code:
*
* @code
* int ompi_atomic_cmpset_32(addr, oldval, newval)
* {
* if (*addr == oldval) {
* *addr = newval;
* return 1; // success, set value
* } else {
* return 0; // failure, do not set value
* }
* }
* @endcode
*/
static inline int ompi_atomic_cmpset_32(volatile uint32_t *addr,
uint32_t oldval,
uint32_t newval);
/**
* Atomic compare and set of unsigned 32-bit integer with acquire
* semantics.
*
* @param addr Address of integer.
* @param oldval Comparison value.
* @param newval New value to set if comparision is true.
*
* See ompi_atomic_cmpset_32 for pseudo-code.
*/
static inline int ompi_atomic_cmpset_acq_32(volatile uint32_t *addr,
uint32_t oldval,
uint32_t newval);
/**
* Atomic compare and set of unsigned 32-bit integer with release
* semantics.
*
* @param addr Address of integer.
* @param oldval Comparison value.
* @param newval New value to set if comparision is true.
*
* See ompi_atomic_cmpset_32 for pseudo-code.
*/
static inline int ompi_atomic_cmpset_rel_32(volatile uint32_t *addr,
uint32_t oldval,
uint32_t newval);
/**
* Atomic compare and set of unsigned 64-bit integer.
*
* @param addr Address of integer.
* @param oldval Comparison value.
* @param newval New value to set if comparision is true.
*
* See ompi_atomic_cmpset_32 for pseudo-code.
*/
static inline int ompi_atomic_cmpset_64(volatile uint64_t *addr,
uint64_t oldval,
uint64_t newval);
/**
* Atomic compare and set of unsigned 64-bit integer with acquire
* semantics.
*
* @param addr Address of integer.
* @param oldval Comparison value.
* @param newval New value to set if comparision is true.
*
* See ompi_atomic_cmpset_32 for pseudo-code.
*/
static inline int ompi_atomic_cmpset_acq_64(volatile uint64_t *addr,
uint64_t oldval,
uint64_t newval);
/**
* Atomic compare and set of unsigned 64-bit integer with release
* semantics.
*
* @param addr Address of integer.
* @param oldval Comparison value.
* @param newval New value to set if comparision is true.
*
* See ompi_atomic_cmpset_32 for pseudo-code.
*/
static inline int ompi_atomic_cmpset_rel_64(volatile uint64_t *addr,
uint64_t oldval,
uint64_t newval);
/**
* Atomic compare and set of integer.
*
* @param addr Address of integer.
* @param oldval Comparison value.
* @param newval New value to set if comparision is true.
*
* See ompi_atomic_cmpset_32 for pseudo-code.
*/
static inline int ompi_atomic_cmpset_int(volatile int *addr,
int oldval,
int newval);
/**
* Atomic compare and set of integer with acquire semantics.
*
* @param addr Address of integer.
* @param oldval Comparison value.
* @param newval New value to set if comparision is true.
*
* See ompi_atomic_cmpset_32 for pseudo-code.
*/
static inline int ompi_atomic_cmpset_acq_int(volatile int *addr,
int oldval,
int newval);
/**
* Atomic compare and set of integer with release semantics.
*
* @param addr Address of integer.
* @param oldval Comparison value.
* @param newval New value to set if comparision is true.
*
* See ompi_atomic_cmpset_32 for pseudo-code.
*/
static inline int ompi_atomic_cmpset_rel_int(volatile int *addr,
int oldval,
int newval);
/**
* Atomic compare and set of pointer.
*
* @param addr Address of integer.
* @param oldval Comparison value.
* @param newval New value to set if comparision is true.
*
* See ompi_atomic_cmpset_32 for pseudo-code.
*/
static inline int ompi_atomic_cmpset_ptr(volatile void *addr,
void *oldval,
void *newval);
/**
* Atomic compare and set of pointer with acquire semantics.
*
* @param addr Address of integer.
* @param oldval Comparison value.
* @param newval New value to set if comparision is true.
*
* See ompi_atomic_cmpset_32 for pseudo-code.
*/
static inline int ompi_atomic_cmpset_acq_ptr(volatile void *addr,
void *oldval,
void *newval);
/**
* Atomic compare and set of pointer with release semantics.
*
* @param addr Address of integer.
* @param oldval Comparison value.
* @param newval New value to set if comparision is true.
*
* See ompi_atomic_cmpset_32 for pseudo-code.
*/
static inline int ompi_atomic_cmpset_rel_ptr(volatile void *addr,
void *oldval,
void *newval);
/**
* Atomically add to a 32-bit integer.
*
* @param addr Address of integer.
* @param delta Value to add.
* @return New value of integer.
*/
static inline uint32_t ompi_atomic_add_32(uint32_t *addr, int delta);
/**
* Atomically add to a 64-bit integer.
*
* @param addr Address of integer.
* @param delta Value to add.
* @return New value of integer.
*/
static inline uint64_t ompi_atomic_add_64(uint64_t *addr, int delta);
/**
* Atomically add to an integer.
*
* @param addr Address of integer.
* @param delta Value to add.
* @return New value of integer.
*/
static inline int ompi_atomic_add_int(int *addr, int delta);
/*
* implementation (system specific)
*/
#if defined (__GNUC__)
#if defined(__alpha__)
# include "sys/alpha/atomic.h"
# define OMPI_ATOMIC_OPS 1
#elif defined(__amd64__)
# include "sys/amd64/atomic.h"
# define OMPI_ATOMIC_OPS 1
#elif defined(__i386__)
# define OMPI_ATOMIC_OPS 1
# include "sys/ia32/atomic.h"
# define OMPI_ATOMIC_OPS 1
#elif defined(__ia64__)
# include "sys/ia64/atomic.h"
# define OMPI_ATOMIC_OPS 1
#elif defined(__POWERPC__)
# include "sys/powerpc/atomic.h"
# define OMPI_ATOMIC_OPS 1
#elif defined(__sparc64__)
# include "sys/sparc/atomic.h"
# define OMPI_ATOMIC_OPS 1
#endif
#endif
/*
* implementation (derived)
*/
#if SIZEOF_INT == 4
static inline int ompi_atomic_cmpset_int(volatile int *addr,
int oldval,
int newval)
{
return ompi_atomic_cmpset_32((volatile uint32_t *) addr,
(uint32_t) oldval,
(uint32_t) newval);
}
static inline int ompi_atomic_cmpset_acq_int(volatile int *addr,
int oldval,
int newval)
{
return ompi_atomic_cmpset_acq_32((volatile uint32_t *) addr,
(uint32_t) oldval,
(uint32_t) newval);
}
static inline int ompi_atomic_cmpset_rel_int(volatile int *addr,
int oldval,
int newval)
{
return ompi_atomic_cmpset_rel_32((volatile uint32_t *) addr,
(uint32_t) oldval,
(uint32_t) newval);
}
#elif SIZEOF_INT == 8
static inline int ompi_atomic_cmpset_int(volatile int *addr,
int oldval,
int newval)
{
return ompi_atomic_cmpset_64((volatile uint64_t *) addr,
(uint64_t) oldval,
(uint64_t) newval);
}
static inline int ompi_atomic_cmpset_acq_int(volatile int *addr,
int oldval,
int newval)
{
return ompi_atomic_cmpset_acq_64((volatile uint64_t *) addr,
(uint64_t) oldval,
(uint64_t) newval);
}
static inline int ompi_atomic_cmpset_rel_int(volatile int *addr,
int oldval,
int newval)
{
return ompi_atomic_cmpset_rel_64((volatile uint64_t *) addr,
(uint64_t) oldval,
(uint64_t) newval);
}
#else
#error
#endif
#if SIZEOF_VOID_P == 4
static inline int ompi_atomic_cmpset_ptr(volatile void *addr,
void *oldval,
void *newval)
{
return ompi_atomic_cmpset_32((volatile uint32_t *) addr,
(uint32_t) oldval, (uint32_t) newval);
}
static inline int ompi_atomic_cmpset_acq_ptr(volatile void *addr,
void *oldval,
void *newval)
{
return ompi_atomic_cmpset_acq_32((volatile uint32_t *) addr,
(uint32_t) oldval, (uint32_t) newval);
}
static inline int ompi_atomic_cmpset_rel_ptr(volatile void *addr,
void *oldval,
void *newval)
{
return ompi_atomic_cmpset_rel_32((volatile uint32_t *) addr,
(uint32_t) oldval, (uint32_t) newval);
}
#elif SIZEOF_VOID_P == 8
static inline int ompi_atomic_cmpset_ptr(volatile void *addr,
void *oldval,
void *newval)
{
return ompi_atomic_cmpset_64((volatile uint64_t *) addr,
(uint64_t) oldval,
(uint64_t) newval);
}
static inline int ompi_atomic_cmpset_acq_ptr(volatile void *addr,
void *oldval,
void *newval)
{
return ompi_atomic_cmpset_acq_64((volatile uint64_t *) addr,
(uint64_t) oldval,
(uint64_t) newval);
}
static inline int ompi_atomic_cmpset_rel_ptr(volatile void *addr,
void *oldval,
void *newval)
{
return ompi_atomic_cmpset_rel_64((volatile uint64_t *) addr,
(uint64_t) oldval,
(uint64_t) newval);
}
#else
#error
#endif
static inline uint32_t ompi_atomic_add_32(uint32_t *addr, int delta)
{
uint32_t oldval;
do {
oldval = *addr;
} while (0 == ompi_atomic_cmpset_32(addr, oldval, oldval + delta));
return (oldval + delta);
}
static inline uint64_t ompi_atomic_add_64(uint64_t *addr, int delta)
{
uint64_t oldval;
do {
oldval = *addr;
} while (0 == ompi_atomic_cmpset_64(addr, oldval, oldval + delta));
return (oldval + delta);
}
static inline int ompi_atomic_add_int(int *addr, int delta)
{
int oldval;
do {
oldval = *addr;
} while (0 == ompi_atomic_cmpset_int(addr, oldval, oldval + delta));
return (oldval + delta);
}
#endif
#endif /* OMPI_ATOMIC_H */

Просмотреть файл

@ -5,3 +5,14 @@
include $(top_srcdir)/config/Makefile.options
SUBDIRS = alpha amd64 ia32 ia64 powerpc sparc64
noinst_HEADERS = atomic.h
# Conditionally install the header files
if WANT_INSTALL_HEADERS
ompidir = $(includedir)/openmpi/include/sys
ompi_HEADERS = $(noinst_HEADERS)
else
ompidir = $(includedir)
endif

Просмотреть файл

@ -4,13 +4,13 @@
include $(top_srcdir)/config/Makefile.options
headers = atomic.h
noinst_HEADERS = atomic.h
# Conditionally install the header files
if WANT_INSTALL_HEADERS
ompidir = $(includedir)/openmpi/include/sys/alpha
ompi_HEADERS = $(headers)
ompi_HEADERS = $(noinst_HEADERS)
else
ompidir = $(includedir)
endif

Просмотреть файл

@ -2,8 +2,8 @@
* $HEADER$
*/
#ifndef OMPI_SYS_ATOMIC_H_INCLUDED
#define OMPI_SYS_ATOMIC_H_INCLUDED
#ifndef OMPI_SYS_ARCH_ATOMIC_H
#define OMPI_SYS_ARCH_ATOMIC_H 1
/*
* On alpha, everything is load-locked, store-conditional...
@ -134,4 +134,4 @@ static inline int ompi_atomic_cmpset_rel_64(volatile uint64_t *addr,
}
#endif /* ! OMPI_SYS_ATOMIC_H_INCLUDED */
#endif /* ! OMPI_SYS_ARCH_ATOMIC_H */

Просмотреть файл

@ -4,13 +4,13 @@
include $(top_srcdir)/config/Makefile.options
headers = atomic.h
noinst_HEADERS = atomic.h
# Conditionally install the header files
if WANT_INSTALL_HEADERS
ompidir = $(includedir)/openmpi/include/sys/amd64
ompi_HEADERS = $(headers)
ompi_HEADERS = $(noinst_HEADERS)
else
ompidir = $(includedir)
endif

Просмотреть файл

@ -2,8 +2,8 @@
* $HEADER$
*/
#ifndef OMPI_SYS_ATOMIC_H_INCLUDED
#define OMPI_SYS_ATOMIC_H_INCLUDED
#ifndef OMPI_SYS_ARCH_ATOMIC_H
#define OMPI_SYS_ARCH_ATOMIC_H 1
/*
* On amd64, we use cmpxchg.
@ -103,4 +103,4 @@ static inline int ompi_atomic_cmpset_rel_64(volatile uint64_t *addr,
return ompi_atomic_cmpset_64( addr, oldval, newval );
}
#endif /* ! OMPI_SYS_ATOMIC_H_INCLUDED */
#endif /* ! OMPI_SYS_ARCH_ATOMIC_H */

Просмотреть файл

@ -15,8 +15,8 @@
* Only the necessary subset of functions are implemented here.
*/
#ifndef OMPI_ATOMIC_H
#define OMPI_ATOMIC_H 1
#ifndef OMPI_SYS_ATOMIC_H
#define OMPI_SYS_ATOMIC_H 1
#include "ompi_config.h"
@ -251,17 +251,17 @@ STATIC_INLINE int ompi_atomic_add_int(int *addr, int delta);
*/
#if defined(__alpha__)
# include "sys/alpha/atomic.h"
# include "alpha/atomic.h"
#elif defined(__amd64__)
# include "sys/amd64/atomic.h"
# include "amd64/atomic.h"
#elif defined(__i386__)
# include "sys/ia32/atomic.h"
# include "ia32/atomic.h"
#elif defined(__ia64__)
# include "sys/ia64/atomic.h"
# include "ia64/atomic.h"
#elif defined(__POWERPC__)
# include "sys/powerpc/atomic.h"
# include "powerpc/atomic.h"
#elif defined(__sparc__) || defined(__sparc)
# include "sys/sparc64/atomic.h"
# include "sparc64/atomic.h"
#endif
#endif
@ -430,4 +430,4 @@ static inline int ompi_atomic_add_int(int *addr, int delta)
return (oldval + delta);
}
#endif /* OMPI_ATOMIC_H */
#endif /* OMPI_SYS_ATOMIC_H */

Просмотреть файл

@ -4,16 +4,19 @@
/** @file
*
* Define the cache caracteristics of the platform
* Define the cache characteristics of the platform
*
*/
#ifndef CACHE
#define CACHE 1
#ifndef OMPI_SYS_CACHE_H
#define OMPI_SYS_CACHE_H 1
/* size of cache line - for now hardwire this to a reasonable
* value, and automate later - RLG */
/**
* Size of cache line.
*
* For now hardwire this to a reasonable value, and automate later - RLG
*/
#define CACHE_LINE_SIZE 128
#endif /* CACHE */
#endif /* OMPI_SYS_CACHE_H */

Просмотреть файл

@ -4,13 +4,13 @@
include $(top_srcdir)/config/Makefile.options
headers = atomic.h
noinst_HEADERS = atomic.h atomic.s
# Conditionally install the header files
if WANT_INSTALL_HEADERS
ompidir = $(includedir)/openmpi/include/sys/ia32
ompi_HEADERS = $(headers)
ompi_HEADERS = $(noinst_HEADERS)
else
ompidir = $(includedir)
endif

Просмотреть файл

@ -2,8 +2,8 @@
* $HEADER$
*/
#ifndef OMPI_SYS_ATOMIC_H_INCLUDED
#define OMPI_SYS_ATOMIC_H_INCLUDED
#ifndef OMPI_SYS_ARCH_ATOMIC_H
#define OMPI_SYS_ARCH_ATOMIC_H 1
/*
* On ia32, we use cmpxchg.
@ -109,4 +109,4 @@ static inline int ompi_atomic_cmpset_rel_64(volatile uint64_t *addr,
return ompi_atomic_cmpset_64(addr, oldval, newval);
}
#endif /* ! OMPI_SYS_ATOMIC_H_INCLUDED */
#endif /* ! OMPI_SYS_ARCH_ATOMIC_H */

Просмотреть файл

@ -4,13 +4,13 @@
include $(top_srcdir)/config/Makefile.options
headers = atomic.h
noinst_HEADERS = atomic.h
# Conditionally install the header files
if WANT_INSTALL_HEADERS
ompidir = $(includedir)/openmpi/include/sys/ia64
ompi_HEADERS = $(headers)
ompi_HEADERS = $(noinst_HEADERS)
else
ompidir = $(includedir)
endif

Просмотреть файл

@ -2,8 +2,8 @@
* $HEADER$
*/
#ifndef OMPI_SYS_ATOMIC_H_INCLUDED
#define OMPI_SYS_ATOMIC_H_INCLUDED
#ifndef OMPI_SYS_ARCH_ATOMIC_H
#define OMPI_SYS_ARCH_ATOMIC_H 1
/*
* On ia64, we use cmpxchg, which supports acquire/release semantics natively.
@ -118,4 +118,4 @@ static inline int ompi_atomic_cmpset_64(volatile uint64_t *addr,
}
#endif /* ! OMPI_SYS_ATOMIC_H_INCLUDED */
#endif /* ! OMPI_SYS_ARCH_ATOMIC_H */

Просмотреть файл

@ -4,13 +4,13 @@
include $(top_srcdir)/config/Makefile.options
headers = atomic.h
noinst_HEADERS = atomic.h atomic.s
# Conditionally install the header files
if WANT_INSTALL_HEADERS
ompidir = $(includedir)/openmpi/include/sys/powerpc
ompi_HEADERS = $(headers)
ompi_HEADERS = $(noinst_HEADERS)
else
ompidir = $(includedir)
endif

Просмотреть файл

@ -2,8 +2,8 @@
* $HEADER$
*/
#ifndef OMPI_SYS_ATOMIC_H_INCLUDED
#define OMPI_SYS_ATOMIC_H_INCLUDED
#ifndef OMPI_SYS_ARCH_ATOMIC_H
#define OMPI_SYS_ARCH_ATOMIC_H 1
/*
* On powerpc ...
@ -128,4 +128,4 @@ static inline int ompi_atomic_cmpset_rel_64(volatile uint64_t *addr,
}
#endif /* ! OMPI_SYS_ATOMIC_H_INCLUDED */
#endif /* ! OMPI_SYS_ARCH_ATOMIC_H */

Просмотреть файл

@ -4,13 +4,13 @@
include $(top_srcdir)/config/Makefile.options
headers = atomic.h
noinst_HEADERS = atomic.h atomic.s
# Conditionally install the header files
if WANT_INSTALL_HEADERS
ompidir = $(includedir)/openmpi/include/sys/sparc64
ompi_HEADERS = $(headers)
ompi_HEADERS = $(noinst_HEADERS)
else
ompidir = $(includedir)
endif

Просмотреть файл

@ -2,8 +2,8 @@
* $HEADER$
*/
#ifndef OMPI_SYS_ATOMIC_H_INCLUDED
#define OMPI_SYS_ATOMIC_H_INCLUDED
#ifndef OMPI_SYS_ARCH_ATOMIC_H
#define OMPI_SYS_ARCH_ATOMIC_H 1
/*
* On sparc64, use casa and casxa (compare and swap) instructions.
@ -106,4 +106,4 @@ static inline int ompi_atomic_cmpset_rel_64(volatile uint64_t *addr,
}
#endif /* ! OMPI_SYS_ATOMIC_H_INCLUDED */
#endif /* ! OMPI_SYS_ARCH_ATOMIC_H */

Просмотреть файл

@ -2,7 +2,9 @@
* $HEADER$
*/
#include "include/atomic.h"
#include "ompi_config.h"
#include "include/sys/atomic.h"
#include "pml_teg.h"
#include "pml_teg_proc.h"
#include "pml_ptl_array.h"

Просмотреть файл

@ -1,8 +1,12 @@
/*
* $HEADER$
*/
#include "ompi_config.h"
#include <string.h>
#include "atomic.h"
#include "sys/atomic.h"
#include "class/ompi_hash_table.h"
#include "mca/base/mca_base_module_exchange.h"
#include "ptl_elan.h"

Просмотреть файл

@ -1,8 +1,12 @@
/*
* $HEADER$
*/
#include "ompi_config.h"
#include <string.h>
#include "atomic.h"
#include "sys/atomic.h"
#include "class/ompi_hash_table.h"
#include "mca/base/mca_base_module_exchange.h"
#include "ptl_gm.h"

Просмотреть файл

@ -1,4 +1,6 @@
#include "include/atomic.h"
#include "ompi_config.h"
#include "include/sys/atomic.h"
#include "class/ompi_hash_table.h"
#include "mca/base/mca_base_module_exchange.h"

Просмотреть файл

@ -1,8 +1,12 @@
/*
* $HEADER$
*/
#include "ompi_config.h"
#include <string.h>
#include "include/atomic.h"
#include "include/sys/atomic.h"
#include "class/ompi_hash_table.h"
#include "mca/base/mca_base_module_exchange.h"
#include "ptl_tcp.h"

Просмотреть файл

@ -31,6 +31,7 @@ headers = \
libutil_la_SOURCES = \
$(headers) \
asm.S \
argv.c \
cmd_line.c \
common_cmd_line.c \

Просмотреть файл

@ -7,7 +7,7 @@
#include "support.h"
#include "include/atomic.h"
#include "include/sys/atomic.h"
/* default options */