1
1

Merge pull request #6055 from ggouaillardet/topic/c11_atomics

Misc C11 atomics related fixes
Этот коммит содержится в:
Gilles Gouaillardet 2018-11-08 09:11:42 +09:00 коммит произвёл GitHub
родитель 2f479d11cc 72eb53e064
Коммит efe72d3d92
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
5 изменённых файлов: 9 добавлений и 204 удалений

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

@ -11,8 +11,8 @@ dnl Copyright (c) 2004-2005 The Regents of the University of California.
dnl All rights reserved. dnl All rights reserved.
dnl Copyright (c) 2008-2018 Cisco Systems, Inc. All rights reserved. dnl Copyright (c) 2008-2018 Cisco Systems, Inc. All rights reserved.
dnl Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved. dnl Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved.
dnl Copyright (c) 2015-2017 Research Organization for Information Science dnl Copyright (c) 2015-2018 Research Organization for Information Science
dnl and Technology (RIST). All rights reserved. dnl and Technology (RIST). All rights reserved.
dnl Copyright (c) 2014-2018 Los Alamos National Security, LLC. All rights dnl Copyright (c) 2014-2018 Los Alamos National Security, LLC. All rights
dnl reserved. dnl reserved.
dnl Copyright (c) 2017 Amazon.com, Inc. or its affiliates. All Rights dnl Copyright (c) 2017 Amazon.com, Inc. or its affiliates. All Rights
@ -1148,6 +1148,9 @@ AC_DEFUN([OPAL_CONFIG_ASM],[
if test "x$enable_c11_atomics" != "xno" && test "$opal_cv_c11_supported" = "yes" ; then if test "x$enable_c11_atomics" != "xno" && test "$opal_cv_c11_supported" = "yes" ; then
opal_cv_asm_builtin="BUILTIN_C11" opal_cv_asm_builtin="BUILTIN_C11"
OPAL_CHECK_C11_CSWAP_INT128 OPAL_CHECK_C11_CSWAP_INT128
elif test "x$enable_c11_atomics" = "xyes"; then
AC_MSG_WARN([C11 atomics were requested but are not supported])
AC_MSG_ERROR([Cannot continue])
else else
opal_cv_asm_builtin="BUILTIN_NO" opal_cv_asm_builtin="BUILTIN_NO"
AS_IF([test "$opal_cv_asm_builtin" = "BUILTIN_NO" && test "$enable_builtin_atomics" = "yes"], AS_IF([test "$opal_cv_asm_builtin" = "BUILTIN_NO" && test "$enable_builtin_atomics" = "yes"],

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

@ -2,6 +2,8 @@
/* /*
* Copyright (c) 2018 Los Alamos National Security, LLC. All rights * Copyright (c) 2018 Los Alamos National Security, LLC. All rights
* reserved. * reserved.
* Copyright (c) 2018 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -23,7 +25,7 @@
#include <stdatomic.h> #include <stdatomic.h>
#include <stdint.h> #include <stdint.h>
#include "opal/include/opal_stdint.h" #include "opal_stdint.h"
#define OPAL_HAVE_ATOMIC_MEM_BARRIER 1 #define OPAL_HAVE_ATOMIC_MEM_BARRIER 1

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

@ -4,7 +4,7 @@ PROGS = mpi_no_op mpi_barrier hello hello_nodename abort multi_abort simple_spaw
crisscross read_write ziatest slave reduce-hang ziaprobe ziatest bcast_loop \ crisscross read_write ziatest slave reduce-hang ziaprobe ziatest bcast_loop \
parallel_w8 parallel_w64 parallel_r8 parallel_r64 sio sendrecv_blaster early_abort \ parallel_w8 parallel_w64 parallel_r8 parallel_r64 sio sendrecv_blaster early_abort \
debugger singleton_client_server intercomm_create spawn_tree init-exit77 mpi_info \ debugger singleton_client_server intercomm_create spawn_tree init-exit77 mpi_info \
info_spawn server client paccept pconnect ring hello.sapp binding badcoll attach xlib \ info_spawn server client ring binding badcoll attach xlib \
no-disconnect nonzero interlib pinterlib add_host no-disconnect nonzero interlib pinterlib add_host
all: $(PROGS) all: $(PROGS)

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

@ -1,102 +0,0 @@
/* -*- C -*-
*
* $HEADER$
*
*/
#include "ompi_config.h"
#include <stdio.h>
#include "mpi.h"
#include "ompi/mca/dpm/dpm.h"
static ompi_communicator_t *newcomp;
static ompi_proc_t *sender;
static void xnt(ompi_communicator_t *newcomm,
ompi_proc_t *remote_proc,
void *cbdata)
{
bool *lock = (bool*)cbdata;
newcomp = newcomm;
sender = remote_proc;
*lock = false;
}
int main(int argc, char* argv[])
{
char port[1024];
bool lock;
FILE *fp;
int rank, rc;
int msg=0;
/* program requires an argument specifying the file where
* the connection info is to be stored
*/
if (2 != argc) {
fprintf(stderr, "Usage: paccept <filename>\n");
exit(1);
}
MPI_Init(&argc, &argv);
/* get a port */
if (OMPI_SUCCESS != ompi_dpm.open_port(port, ORTE_RML_TAG_INVALID)) {
fprintf(stderr, "Failed to open port\n");
goto cleanup;
}
/* put it in the file */
fp = fopen(argv[1], "w");
fprintf(fp, "%s\n", port);
fclose(fp);
/* register the accept */
lock = true;
if (OMPI_SUCCESS != ompi_dpm.paccept(port, xnt, &lock)) {
fprintf(stderr, "Failed to setup accept\n");
goto cleanup;
}
/* wait for completion */
OMPI_WAIT_FOR_COMPLETION(lock);
/* allocate comm_cid */
rank = ompi_comm_rank(MPI_COMM_SELF);
rc = ompi_comm_nextcid(newcomp, /* new communicator */
MPI_COMM_SELF, /* old communicator */
NULL, /* bridge comm */
&rank, /* local leader */
&sender->super.proc_name, /* remote leader */
OMPI_COMM_CID_INTRA_OOB, /* mode */
false); /* send or recv first */
if ( OMPI_SUCCESS != rc ) {
fprintf(stderr, "Failed to negotiate cid\n");
goto cleanup;
}
/* activate comm and init coll-component */
rc = ompi_comm_activate(&newcomp, /* new communicator */
MPI_COMM_SELF, /* old communicator */
NULL, /* bridge comm */
&rank, /* local leader */
&sender->super.proc_name, /* remote leader */
OMPI_COMM_CID_INTRA_OOB, /* mode */
false); /* send or recv first */
if ( OMPI_SUCCESS != rc ) {
fprintf(stderr, "Failed to activate communicator\n");
goto cleanup;
}
fprintf(stderr, "HANDSHAKE COMPLETE\n");
MPI_Recv(&msg, 1, MPI_INT, 0, 1, newcomp, MPI_STATUS_IGNORE);
MPI_Comm_disconnect(&newcomp);
fprintf(stderr, "MESSAGE RECVD: %d\n", msg);
ompi_dpm.pclose(port);
cleanup:
MPI_Finalize();
return 0;
}

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

@ -1,98 +0,0 @@
/* -*- C -*-
*
* $HEADER$
*
*/
#include "ompi_config.h"
#include <stdio.h>
#include "mpi.h"
#include "ompi/mca/dpm/dpm.h"
static ompi_communicator_t *newcomp;
static ompi_proc_t *sender;
static void xnt(ompi_communicator_t *newcomm,
ompi_proc_t *remote_proc,
void *cbdata)
{
bool *lock = (bool*)cbdata;
newcomp = newcomm;
sender = remote_proc;
*lock = false;
}
int main(int argc, char* argv[])
{
char port[1024];
bool lock;
FILE *fp;
int rank, rc;
int msg;
/* program requires an argument specifying the file where
* the connection info is to be found
*/
if (2 != argc) {
fprintf(stderr, "Usage: pconnect <filename>\n");
exit(1);
}
MPI_Init(&argc, &argv);
/* read the file */
fp = fopen(argv[1], "r");
fgets(port, 1024, fp);
port[strlen(port)-1] = '\0'; /* remove newline */
fclose(fp);
/* start the connect */
lock = true;
if (OMPI_SUCCESS != ompi_dpm.pconnect(port, NULL, xnt, &lock)) {
fprintf(stderr, "Failed to start connect\n");
goto cleanup;
}
/* wait for completion */
OMPI_WAIT_FOR_COMPLETION(lock);
/* allocate comm_cid */
rank = ompi_comm_rank(MPI_COMM_SELF);
rc = ompi_comm_nextcid(newcomp, /* new communicator */
MPI_COMM_SELF, /* old communicator */
NULL, /* bridge comm */
&rank, /* local leader */
&sender->super.proc_name, /* remote leader */
OMPI_COMM_CID_INTRA_OOB, /* mode */
true); /* send or recv first */
if ( OMPI_SUCCESS != rc ) {
fprintf(stderr, "Failed to negotiate cid\n");
goto cleanup;
}
/* activate comm and init coll-component */
rc = ompi_comm_activate(&newcomp, /* new communicator */
MPI_COMM_SELF, /* old communicator */
NULL, /* bridge comm */
&rank, /* local leader */
&sender->super.proc_name, /* remote leader */
OMPI_COMM_CID_INTRA_OOB, /* mode */
true); /* send or recv first */
if ( OMPI_SUCCESS != rc ) {
fprintf(stderr, "Failed to activate communicator\n");
goto cleanup;
}
fprintf(stderr, "HANDSHAKE COMPLETE\n");
msg = 38;
MPI_Send(&msg, 1, MPI_INT, 0, 1, newcomp);
MPI_Comm_disconnect(&newcomp);
fprintf(stderr, "MESSAGE SENT\n");
cleanup:
MPI_Finalize();
return 0;
}