Support the atomic.h and timer.h header files.
This commit was SVN r8462.
Этот коммит содержится в:
родитель
d8d67b618f
Коммит
1f342275a0
@ -117,7 +117,7 @@ typedef struct opal_atomic_lock_t opal_atomic_lock_t;
|
||||
*********************************************************************/
|
||||
#if defined(DOXYGEN)
|
||||
/* don't include system-level gorp when generating doxygen files */
|
||||
#elif OMPI_ASSEMBLY_ARCH == OMPI_WINDOWS || defined(WIN32)
|
||||
#elif OMPI_ASSEMBLY_ARCH == OMPI_WINDOWS
|
||||
/* windows first, as they have API-level primitives for this stuff */
|
||||
#include "include/sys/win32/atomic.h"
|
||||
#elif OMPI_ASSEMBLY_ARCH == OMPI_ALPHA
|
||||
|
@ -90,6 +90,8 @@ extern "C" {
|
||||
#include "include/sys/sparcv9/timer.h"
|
||||
#elif OMPI_ASSEMBLY_ARCH == OMPI_SPARCV9_64
|
||||
#include "include/sys/sparcv9/timer.h"
|
||||
#elif OMPI_ASSEMBLY_ARCH == OMPI_WINDOWS
|
||||
#include "include/sys/win32/timer.h"
|
||||
#endif
|
||||
|
||||
#ifndef DOXYGEN
|
||||
|
@ -19,6 +19,12 @@
|
||||
#ifndef OMPI_SYS_ARCH_ATOMIC_H
|
||||
#define OMPI_SYS_ARCH_ATOMIC_H 1
|
||||
|
||||
#include <windows.h>
|
||||
#if defined(HAVE_WDM_H)
|
||||
#include <wdm.h>
|
||||
#endif /* HAVE_WDM_H */
|
||||
#include "ompi_stdint.h"
|
||||
|
||||
/**********************************************************************
|
||||
*
|
||||
* Memory Barriers
|
||||
@ -28,28 +34,25 @@
|
||||
|
||||
static inline void opal_atomic_mb(void)
|
||||
{
|
||||
#if 0
|
||||
#if defined(HAVE_WDM_H)
|
||||
return KeMemoryBarrier();
|
||||
#endif
|
||||
#endif /* HAVE_WDM_H */
|
||||
}
|
||||
|
||||
|
||||
static inline void opal_atomic_rmb(void)
|
||||
{
|
||||
#if 0
|
||||
#if defined(HAVE_WDM_H)
|
||||
return KeMemoryBarrier();
|
||||
#endif
|
||||
#endif /* HAVE_WDM_H */
|
||||
}
|
||||
|
||||
|
||||
static inline void opal_atomic_wmb(void)
|
||||
{
|
||||
#if 0
|
||||
#if defined(HAVE_WDM_H)
|
||||
return KeMemoryBarrier();
|
||||
#endif
|
||||
#endif /* HAVE_WDM_H */
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
*
|
||||
* Atomic math operations
|
||||
@ -57,80 +60,74 @@ static inline void opal_atomic_wmb(void)
|
||||
*********************************************************************/
|
||||
|
||||
#define OPAL_HAVE_ATOMIC_CMPSET_32 1
|
||||
static inline int opal_atomic_cmpset_acq_32( volatile int32_t *addr,
|
||||
static inline int32_t opal_atomic_cmpset_acq_32( volatile int32_t *addr,
|
||||
int32_t oldval, int32_t newval)
|
||||
{
|
||||
#if 0
|
||||
int32_t ret = InterlockedCompareExchangeAcquire ((int32_t volatile*) addr,
|
||||
(int32_t) newval, (int32_t) oldval);
|
||||
int32_t ret = InterlockedCompareExchangeAcquire ((long volatile*) addr,
|
||||
(long) newval, (long) oldval);
|
||||
return (oldval == ret) ? 1: 0;
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
static inline int opal_atomic_cmpset_rel_32( volatile int32_t *addr,
|
||||
static inline int32_t opal_atomic_cmpset_rel_32( volatile int32_t *addr,
|
||||
int32_t oldval, int32_t newval)
|
||||
{
|
||||
#if 0
|
||||
int32_t ret = InterlockedCompareExchangeRelease ((int32_t volatile*) addr,
|
||||
(int32_t) newval, (int32_t) oldval);
|
||||
int32_t ret = InterlockedCompareExchangeRelease ((long volatile*) addr,
|
||||
(long) newval, (long) oldval);
|
||||
return (oldval == ret) ? 1: 0;
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline int opal_atomic_cmpset_32( volatile int32_t *addr,
|
||||
static inline int32_t opal_atomic_cmpset_32( volatile int32_t *addr,
|
||||
int32_t oldval, int32_t newval)
|
||||
{
|
||||
#if 0
|
||||
int32_t ret = InterlockedCompareExchange ((int32_t volatile*) addr,
|
||||
(int32_t) newval, (int32_t) oldval);
|
||||
int32_t ret = InterlockedCompareExchange ((long volatile*) addr,
|
||||
(long) newval, (long) oldval);
|
||||
|
||||
return (oldval == ret) ? 1: 0;
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
#define OPAL_HAVE_ATOMIC_CMPSET_64 1
|
||||
static inline int opal_atomic_cmpset_acq_64( volatile int64_t *addr,
|
||||
int64_t oldval, int64_t newval)
|
||||
{
|
||||
#if 0
|
||||
int64_t ret = InterlockedCompareExchangeAcquire64 ((int64_t volatile*) addr,
|
||||
#if OMPI_ENABLE_DEBUG
|
||||
/* The address should be 64 bits aligned otherwise ...
|
||||
* http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/interlockedcompareexchange64.asp
|
||||
*/
|
||||
#endif /* OMPI_ENABLE_DEBUG */
|
||||
#if defined(OMPI_WINDOWS_HAVE_SUPPORT_FOR_64_BITS_ATOMIC)
|
||||
#define OPAL_HAVE_ATOMIC_CMPSET_64 1
|
||||
int64_t ret = InterlockedCompareExchangeAcquire64 ((int64_t volatile*) addr,
|
||||
(int64_t) newval, (int64_t) oldval);
|
||||
return (oldval == ret) ? 1: 0;
|
||||
return (oldval == ret) ? 1: 0;
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
#define OPAL_HAVE_ATOMIC_CMPSET_64 0
|
||||
return 0;
|
||||
#endif /* OMPI_WINDOWS_HAVE_SUPPORT_FOR_64_BITS_ATOMIC */
|
||||
}
|
||||
|
||||
static inline int opal_atomic_cmpset_rel_64( volatile int64_t *addr,
|
||||
int64_t oldval, int64_t newval)
|
||||
{
|
||||
#if 0
|
||||
int64_t ret = InterlockedCompareExchangeRelease64 ((int64_t volatile*) addr,
|
||||
(int64_t) newval, (int64_t) oldval);
|
||||
return (oldval == ret) ? 1: 0;
|
||||
#if defined(OMPI_WINDOWS_HAVE_SUPPORT_FOR_64_BITS_ATOMIC)
|
||||
int64_t ret = InterlockedCompareExchangeRelease64 ((int64_t volatile*) addr,
|
||||
(int64_t) newval, (int64_t) oldval);
|
||||
return (oldval == ret) ? 1: 0;
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
return 0;
|
||||
#endif /* OMPI_WINDOWS_HAVE_SUPPORT_FOR_64_BITS_ATOMIC */
|
||||
}
|
||||
|
||||
|
||||
static inline int opal_atomic_cmpset_64( volatile int64_t *addr,
|
||||
int64_t oldval, int64_t newval)
|
||||
{
|
||||
#if 0
|
||||
int64_t ret = InterlockedCompareExchange64 ((int64_t volatile*) addr,
|
||||
(int64_t) newval, (int64_t) oldval);
|
||||
return (oldval == ret) ? 1: 0;
|
||||
#if defined(OMPI_WINDOWS_HAVE_SUPPORT_FOR_64_BITS_ATOMIC)
|
||||
int64_t ret = InterlockedCompareExchange64 ((int64_t volatile*) addr,
|
||||
(int64_t) newval, (int64_t) oldval);
|
||||
return (oldval == ret) ? 1: 0;
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
return 0;
|
||||
#endif /* OMPI_WINDOWS_HAVE_SUPPORT_FOR_64_BITS_ATOMIC */
|
||||
}
|
||||
|
||||
#define OPAL_HAVE_ATOMIC_MATH_32 1
|
||||
@ -139,41 +136,41 @@ static inline int opal_atomic_cmpset_64( volatile int64_t *addr,
|
||||
static inline int32_t opal_atomic_add_32(volatile int32_t *addr, int32_t delta)
|
||||
{
|
||||
return InterlockedExchangeAdd ((LONG volatile *) addr,
|
||||
(int32_t) delta);
|
||||
(LONG) delta);
|
||||
|
||||
}
|
||||
|
||||
#define OPAL_HAVE_ATOMIC_MATH_64 1
|
||||
|
||||
#define OPAL_HAVE_ATOMIC_ADD_64 1
|
||||
static inline int64_t opal_atomic_add_64(volatile int64_t *addr, int64_t delta)
|
||||
{
|
||||
#if 0
|
||||
return InterlockedExchangeAdd64 ((int64_t volatile *) addr,
|
||||
(int64_t) delta);
|
||||
#if defined(OMPI_WINDOWS_HAVE_SUPPORT_FOR_64_BITS_ATOMIC)
|
||||
#define OPAL_HAVE_ATOMIC_MATH_64 1
|
||||
#define OPAL_HAVE_ATOMIC_ADD_64 1
|
||||
return InterlockedExchangeAdd64 ((int64_t volatile *) addr,
|
||||
(int64_t) delta);
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
|
||||
#define OPAL_HAVE_ATOMIC_MATH_64 0
|
||||
#define OPAL_HAVE_ATOMIC_ADD_64 0
|
||||
return 0;
|
||||
#endif /* OMPI_WINDOWS_HAVE_SUPPORT_FOR_64_BITS_ATOMIC */
|
||||
}
|
||||
|
||||
#define OPAL_HAVE_ATOMIC_SUB_32 1
|
||||
static inline int32_t opal_atomic_sub_32(volatile int32_t *addr, int32_t delta)
|
||||
{
|
||||
return InterlockedExchangeAdd( (LONG volatile *) addr,
|
||||
(int32_t) (-delta));
|
||||
(LONG) (-delta));
|
||||
|
||||
}
|
||||
|
||||
#define OPAL_HAVE_ATOMIC_SUB_64 1
|
||||
static inline int64_t opal_atomic_sub_64(volatile int64_t *addr, int64_t delta)
|
||||
{
|
||||
#if 0
|
||||
return InterlockedExchangeAdd64 ((int64_t volatile *) addr,
|
||||
(int64_t) (-delta));
|
||||
#if defined(OMPI_WINDOWS_HAVE_SUPPORT_FOR_64_BITS_ATOMIC)
|
||||
#define OPAL_HAVE_ATOMIC_SUB_64 1
|
||||
return InterlockedExchangeAdd64 ((int64_t volatile *) addr,
|
||||
(int64_t) (-delta));
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
|
||||
#define OPAL_HAVE_ATOMIC_SUB_64 0
|
||||
return 0;
|
||||
#endif /* OMPI_WINDOWS_HAVE_SUPPORT_FOR_64_BITS_ATOMIC */
|
||||
}
|
||||
#endif /* ! OMPI_SYS_ARCH_ATOMIC_H */
|
||||
|
29
opal/include/sys/win32/timer.h
Обычный файл
29
opal/include/sys/win32/timer.h
Обычный файл
@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
||||
* University Research and Technology
|
||||
* Corporation. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The University of Tennessee and The University
|
||||
* of Tennessee Research Foundation. All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
||||
* University of Stuttgart. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
#ifndef OMPI_SYS_ARCH_TIMER_H
|
||||
#define OMPI_SYS_ARCH_TIMER_H 1
|
||||
|
||||
|
||||
typedef LONGLONG opal_timer_t;
|
||||
|
||||
opal_timer_t opal_sys_timer_get_cycles(void);
|
||||
|
||||
#define OPAL_HAVE_SYS_TIMER_GET_CYCLES 1
|
||||
|
||||
#endif /* ! OMPI_SYS_ARCH_TIMER_H */
|
Загрузка…
Ссылка в новой задаче
Block a user