Skip to content

Commit c11029d

Browse files
shintaro-iwasakihppritcha
authored andcommitted
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. Signed-off-by: Shintaro Iwasaki <siwasaki@anl.gov>
1 parent df32ce8 commit c11029d

21 files changed

+1166
-21
lines changed

config/opal_config_argobots.m4

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,19 @@ dnl Additional copyrights may follow
1919
dnl
2020
dnl $HEADER$
2121
dnl
22-
dnl OPAL_CONFIG_ARGOBOT_THREADS()
22+
dnl OPAL_CONFIG_ARGOBOTS_THREADS()
2323
dnl
24-
dnl Configure argobot threads, setting the following variables (but
24+
dnl Configure Argobots threads, setting the following variables (but
2525
dnl not calling AC_SUBST on them).
2626

27-
#********************************************************************
28-
#
29-
# TODO: work in progress
30-
#
31-
#********************************************************************
32-
AC_DEFUN([OPAL_CONFIG_ARGOBOT_THREADS],[
33-
AC_REQUIRE([AC_PROG_GREP])
34-
[$2]
27+
AC_DEFUN([OPAL_CONFIG_ARGOBOTS_THREADS],[
28+
AC_CHECK_HEADERS([abt.h],
29+
[AC_CHECK_LIB([abt],[ABT_init],
30+
[threads_argobots_happy="yes"],
31+
[threads_argobots_happy="no"])],
32+
[threads_argobots_happy="no"])
33+
34+
AS_IF([test "$threads_argobots_happy" = "yes"],
35+
[$1],
36+
[$2])
3537
])dnl

config/opal_config_threads.m4

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,16 +63,16 @@ AS_IF([test -z "$with_threads" || test "$with_threads" = "pthreads" || test "$wi
6363
#
6464
# see if argobots is called for
6565
#
66-
AS_IF([test -z "$thread_type_found" && test "$with_threads" = argobots"],
67-
[OPAL_CONFIG_ARGOBOT_THREADS(HAVE_THREAD_PKG=1, HAVE_THREAD_PKG=0)
66+
AS_IF([test -z "$thread_type_found" && test "$with_threads" = "argobots"],
67+
[OPAL_CONFIG_ARGOBOTS_THREADS(HAVE_THREAD_PKG=1, HAVE_THREAD_PKG=0)
6868
AC_MSG_CHECKING([for working ARGOBOTS threads package])
6969
AS_IF([test "$HAVE_THREAD_PKG" = "1"],
7070
[AC_MSG_RESULT([yes])
7171
thread_type_found="argobots"],
7272
[AC_MSG_RESULT([no])])],
7373
[])
7474
75-
AS_IF([test -z "$thread_type_found" && test "$with_threads" = qthreads"],
75+
AS_IF([test -z "$thread_type_found" && test "$with_threads" = "qthreads"],
7676
[OPAL_CONFIG_QTHREADS(HAVE_THREAD_PKG=1, HAVE_THREAD_PKG=0)
7777
AC_MSG_CHECKING([for working Qthreads package])
7878
AS_IF([test "$HAVE_THREAD_PKG" = "1"],

opal/mca/event/libevent2022/libevent/poll.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,9 @@ poll_dispatch(struct event_base *base, struct timeval *tv)
162162

163163
EVBASE_RELEASE_LOCK(base, th_base_lock);
164164

165+
if (msec > 0) {
166+
msec = 0;
167+
}
165168
res = poll(event_set, nfds, msec);
166169

167170
EVBASE_ACQUIRE_LOCK(base, th_base_lock);

opal/mca/threads/argobots/Makefile.am

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#
2+
# Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
3+
# University Research and Technology
4+
# Corporation. All rights reserved.
5+
# Copyright (c) 2004-2005 The University of Tennessee and The University
6+
# of Tennessee Research Foundation. All rights
7+
# reserved.
8+
# Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
9+
# University of Stuttgart. All rights reserved.
10+
# Copyright (c) 2004-2005 The Regents of the University of California.
11+
# All rights reserved.
12+
# Copyright (c) 2008 Cisco Systems, Inc. All rights reserved.
13+
# Copyright (c) 2019 Sandia National Laboratories. All rights reserved.
14+
# $COPYRIGHT$
15+
#
16+
# Additional copyrights may follow
17+
#
18+
# $HEADER$
19+
#
20+
21+
noinst_LTLIBRARIES = libmca_threads_argobots.la
22+
23+
libmca_threads_argobots_la_SOURCES = \
24+
threads_argobots.h \
25+
threads_argobots_component.c \
26+
threads_argobots_condition.c \
27+
threads_argobots_event.c \
28+
threads_argobots_module.c \
29+
threads_argobots_mutex.c \
30+
threads_argobots_mutex.h \
31+
threads_argobots_threads.h \
32+
threads_argobots_tsd.h \
33+
threads_argobots_wait_sync.c \
34+
threads_argobots_wait_sync.h
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# -*- shell-script -*-
2+
#
3+
# Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
4+
# University Research and Technology
5+
# Corporation. All rights reserved.
6+
# Copyright (c) 2004-2005 The University of Tennessee and The University
7+
# of Tennessee Research Foundation. All rights
8+
# reserved.
9+
# Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
10+
# University of Stuttgart. All rights reserved.
11+
# Copyright (c) 2004-2005 The Regents of the University of California.
12+
# All rights reserved.
13+
# Copyright (c) 2010 Cisco Systems, Inc. All rights reserved.
14+
# Copyright (c) 2015 Research Organization for Information Science
15+
# and Technology (RIST). All rights reserved.
16+
# Copyright (c) 2019 Sandia National Laboratories. All rights reserved.
17+
# Copyright (c) 2019 Triad National Security, LLC. All rights
18+
# $COPYRIGHT$
19+
#
20+
# Additional copyrights may follow
21+
#
22+
# $HEADER$
23+
#
24+
AC_DEFUN([MCA_opal_threads_argobots_PRIORITY], [30])
25+
26+
AC_DEFUN([MCA_opal_threads_argobots_COMPILE_MODE], [
27+
AC_MSG_CHECKING([for MCA component $2:$3 compile mode])
28+
$4="static"
29+
AC_MSG_RESULT([$$4])
30+
])
31+
32+
AC_DEFUN([MCA_opal_threads_argobots_POST_CONFIG],[
33+
AS_IF([test "$1" = "1"], [threads_base_include="argobots/threads_argobots_threads.h"])
34+
])dnl
35+
36+
AC_DEFUN([MCA_opal_mutex_argobots_POST_CONFIG],[
37+
AS_IF([test "$1" = "1"], [mutex_base_include="argobots/threads_argobots_mutex.h"])
38+
AC_MSG_CHECKING([mutex_base_include = $mutex_base_include])
39+
])dnl
40+
41+
AC_DEFUN([MCA_opal_tsd_argobots_POST_CONFIG],[
42+
AS_IF([test "$1" = "1"], [threads_base_include="argobots/threads_argobots_tsd.h"])
43+
AC_MSG_CHECKING([threads_base_include = $threads_base_include])
44+
])dnl
45+
46+
AC_DEFUN([MCA_opal_wait_sync_argobots_POST_CONFIG],[
47+
AS_IF([test "$1" = "1"], [wait_sync_base_include="argobots/threads_argobots_wait_sync.h"])
48+
AC_MSG_CHECKING([wait_sync_base_include = $wait_sync_base_include])
49+
])dnl
50+
51+
# MCA_threads_argobots_CONFIG(action-if-can-compile,
52+
# [action-if-cant-compile])
53+
# ------------------------------------------------
54+
AC_DEFUN([MCA_opal_threads_argobots_CONFIG],[
55+
AC_CONFIG_FILES([opal/mca/threads/argobots/Makefile])
56+
57+
AC_MSG_CHECKING([HAVE_THREAD_PKG_TYPE = $HAVE_THREAD_PKG_TYPE])
58+
59+
AS_IF([test "$HAVE_THREAD_PKG_TYPE" = "argobots"],
60+
[$1],
61+
[$2])
62+
])

opal/mca/threads/argobots/owner.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#
2+
# owner/status file
3+
# owner: institution that is responsible for this package
4+
# status: e.g. active, maintenance, unmaintained
5+
#
6+
owner: SNL
7+
status: unmaintained
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
2+
#ifndef OPAL_MCA_THREADS_ARGOBOTS_THREADS_ARGOBOTS_H
3+
#define OPAL_MCA_THREADS_ARGOBOTS_THREADS_ARGOBOTS_H 1
4+
5+
#include <abt.h>
6+
7+
static inline void ensure_init_argobots(void) {
8+
if (ABT_initialized() != 0)
9+
ABT_init(0, 0);
10+
}
11+
12+
#endif /* OPAL_MCA_THREADS_ARGOBOTS_THREADS_ARGOBOTS_H */
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
2+
/*
3+
* Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
4+
* University Research and Technology
5+
* Corporation. All rights reserved.
6+
* Copyright (c) 2004-2014 The University of Tennessee and The University
7+
* of Tennessee Research Foundation. All rights
8+
* reserved.
9+
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
10+
* University of Stuttgart. All rights reserved.
11+
* Copyright (c) 2004-2005 The Regents of the University of California.
12+
* All rights reserved.
13+
* Copyright (c) 2007-2015 Los Alamos National Security, LLC. All rights
14+
* reserved.
15+
* Copyright (c) 2019 Sandia National Laboratories. All rights reserved.
16+
*
17+
* $COPYRIGHT$
18+
*
19+
* Additional copyrights may follow
20+
*
21+
* $HEADER$
22+
*/
23+
24+
#include "opal_config.h"
25+
26+
#include "opal/mca/threads/argobots/threads_argobots.h"
27+
#include "opal/mca/threads/thread.h"
28+
#include "opal/mca/threads/threads.h"
29+
#include "opal/constants.h"
30+
#include <abt.h>
31+
32+
static int opal_threads_argobots_open(void);
33+
34+
const opal_threads_base_component_2_0_0_t mca_threads_argobots_component = {
35+
/* First, the mca_component_t struct containing meta information
36+
about the component itself */
37+
.threadsc_version = {
38+
OPAL_THREADS_BASE_VERSION_2_0_0,
39+
40+
/* Component name and version */
41+
.mca_component_name = "argobots",
42+
MCA_BASE_MAKE_VERSION(component, OPAL_MAJOR_VERSION, OPAL_MINOR_VERSION,
43+
OPAL_RELEASE_VERSION),
44+
45+
.mca_open_component = opal_threads_argobots_open,
46+
},
47+
.threadsc_data = {
48+
/* The component is checkpoint ready */
49+
MCA_BASE_METADATA_PARAM_CHECKPOINT
50+
},
51+
};
52+
53+
int opal_threads_argobots_open(void)
54+
{
55+
ensure_init_argobots();
56+
return OPAL_SUCCESS;
57+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/*
2+
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
3+
* University Research and Technology
4+
* Corporation. All rights reserved.
5+
* Copyright (c) 2004-2005 The University of Tennessee and The University
6+
* of Tennessee Research Foundation. All rights
7+
* reserved.
8+
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
9+
* University of Stuttgart. All rights reserved.
10+
* Copyright (c) 2004-2005 The Regents of the University of California.
11+
* All rights reserved.
12+
* Copyright (c) 2019 Sandia National Laboratories. All rights reserved.
13+
*
14+
* $COPYRIGHT$
15+
*
16+
* Additional copyrights may follow
17+
*
18+
* $HEADER$
19+
*/
20+
21+
#include "opal_config.h"
22+
23+
#include "opal/mca/threads/condition.h"
24+
25+
26+
static void opal_condition_construct(opal_condition_t *c)
27+
{
28+
c->c_waiting = 0;
29+
c->c_signaled = 0;
30+
}
31+
32+
33+
static void opal_condition_destruct(opal_condition_t *c)
34+
{
35+
}
36+
37+
OBJ_CLASS_INSTANCE(opal_condition_t,
38+
opal_object_t,
39+
opal_condition_construct,
40+
opal_condition_destruct);

0 commit comments

Comments
 (0)