
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>
68 строки
1.5 KiB
C
68 строки
1.5 KiB
C
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
|
|
/*
|
|
* Copyright (c) 2010 Cisco Systems, Inc. All rights reserved.
|
|
* Copyright (c) 2014 The University of Tennessee and The University
|
|
* of Tennessee Research Foundation. All rights
|
|
* reserved.
|
|
* Copyright (c) 2018 Los Alamos National Security, LLC. All rights
|
|
* reserved.
|
|
* $COPYRIGHT$
|
|
*/
|
|
|
|
#include "opal_config.h"
|
|
|
|
#include <stdio.h>
|
|
|
|
#include "support.h"
|
|
#include "opal/constants.h"
|
|
#include "opal/mca/threads/threads.h"
|
|
#include "opal/sys/atomic.h"
|
|
|
|
|
|
/* Only have the body of this test if we have thread support */
|
|
|
|
static opal_atomic_int_t count = 0;
|
|
|
|
|
|
static void* thr1_run(opal_object_t* obj)
|
|
{
|
|
opal_atomic_add (&count, 1);
|
|
return NULL;
|
|
}
|
|
|
|
static void* thr2_run(opal_object_t* obj)
|
|
{
|
|
opal_atomic_add (&count, 2);
|
|
return NULL;
|
|
}
|
|
|
|
int main(int argc, char** argv)
|
|
{
|
|
int rc;
|
|
opal_thread_t thr1;
|
|
opal_thread_t thr2;
|
|
|
|
test_init("opal_thread_t");
|
|
|
|
OBJ_CONSTRUCT(&thr1, opal_thread_t);
|
|
OBJ_CONSTRUCT(&thr2, opal_thread_t);
|
|
|
|
thr1.t_run = thr1_run;
|
|
thr2.t_run = thr2_run;
|
|
|
|
rc = opal_thread_start(&thr1);
|
|
test_verify_int(OPAL_SUCCESS, rc);
|
|
|
|
rc = opal_thread_start(&thr2);
|
|
test_verify_int(OPAL_SUCCESS, rc);
|
|
|
|
rc = opal_thread_join(&thr1, NULL);
|
|
test_verify_int(OPAL_SUCCESS, rc);
|
|
|
|
rc = opal_thread_join(&thr2, NULL);
|
|
test_verify_int(OPAL_SUCCESS, rc);
|
|
|
|
test_verify_int(3, count);
|
|
return test_finalize();
|
|
}
|