1
1
openmpi/opal/mca/threads/wait_sync.h
Noah Evans ee3517427e Add threads framework
Add a framework to support different types of threading models including
user space thread packages such as Qthreads and argobot:

https://github.com/pmodels/argobots

https://github.com/Qthreads/qthreads

The default threading model is pthreads.  Alternate thread models are
specificed at configure time using the --with-threads=X option.

The framework is static.  The theading model to use is selected at
Open MPI configure/build time.

mca/threads: implement Argobots threading layer

config: fix thread configury

- Add double quotations
- Change Argobot to Argobots
config: implement Argobots check

If the poll time is too long, MPI hangs.

This quick fix just sets it to 0, but it is not good for the
Pthreads version. Need to find a good way to abstract it.

Note that even 1 (= 1 millisecond) causes disastrous performance
degradation.

rework threads MCA framework configury

It now works more like the ompi/mca/rte configury,
modulo some edge items that are special for threading package
linking, etc.

qthreads module
some argobots cleanup

Signed-off-by: Noah Evans <noah.evans@gmail.com>
Signed-off-by: Shintaro Iwasaki <siwasaki@anl.gov>
Signed-off-by: Howard Pritchard <howardp@lanl.gov>
2020-03-27 10:15:45 -06:00

61 строка
1.9 KiB
C

/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2014-2016 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2016 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2016 Mellanox Technologies. All rights reserved.
* Copyright (c) 2016 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2017 IBM Corporation. All rights reserved.
* Copyright (c) 2019 Sandia National Laboratories. All rights reserved.
*
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#ifndef OPAL_MCA_THREADS_WAIT_SYNC_H
#define OPAL_MCA_THREADS_WAIT_SYNC_H
#include "opal/sys/atomic.h"
#include "opal/mca/threads/condition.h"
BEGIN_C_DECLS
extern int opal_max_thread_in_progress;
#include MCA_threads_wait_sync_base_include_HEADER
#define REQUEST_PENDING (void *)0L
#define REQUEST_COMPLETED (void *)1L
/**
* Update the status of the synchronization primitive. If an error is
* reported the synchronization is completed and the signal
* triggered. The status of the synchronization will be reported to
* the waiting threads.
*/
static inline void wait_sync_update(ompi_wait_sync_t *sync, int updates,
int status)
{
if (OPAL_LIKELY(OPAL_SUCCESS == status)) {
if (0 != (OPAL_THREAD_ADD_FETCH32(&sync->count, -updates))) {
return;
}
} else {
/* this is an error path so just use the atomic */
sync->status = OPAL_ERROR;
opal_atomic_wmb();
opal_atomic_swap_32(&sync->count, 0);
}
WAIT_SYNC_SIGNAL(sync);
}
END_C_DECLS
#endif /* OPAL_MCA_THREADS_WAIT_SYNC_H */