Skip to content
This repository was archived by the owner on Sep 30, 2022. It is now read-only.

Commit f782f8b

Browse files
committed
Merge pull request #390 from rolfv/pr/add-cuda-mpiext
Bring cuda mpiext over to 2.x. They are ready.
2 parents 9fcc362 + 7b5be1a commit f782f8b

File tree

7 files changed

+206
-0
lines changed

7 files changed

+206
-0
lines changed

ompi/mpiext/cuda/Makefile.am

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#
2+
# Copyright (c) 2004-2009 The Trustees of Indiana University and Indiana
3+
# University Research and Technology
4+
# Corporation. All rights reserved.
5+
# Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved.
6+
# Copyright (c) 2015 NVIDIA, Inc. All rights reserved
7+
# $COPYRIGHT$
8+
#
9+
# Additional copyrights may follow
10+
#
11+
# $HEADER$
12+
#
13+
14+
# This Makefile is not traversed during a normal "make all" in an OMPI
15+
# build. It *is* traversed during "make dist", however. So you can
16+
# put EXTRA_DIST targets in here.
17+
#
18+
# You can also use this as a convenience for building this MPI
19+
# extension (i.e., "make all" in this directory to invoke "make all"
20+
# in all the subdirectories).
21+
22+
SUBDIRS = c
23+
24+
EXTRA_DIST = README.txt

ompi/mpiext/cuda/README.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Copyright (c) 2015 NVIDIA, Inc. All rights reserved.
2+
3+
$COPYRIGHT$
4+
5+
Rolf vandeVaart
6+
7+
8+
This extension provides a macro for compile time check of CUDA aware support.
9+
It also provides a function for runtime check of CUDA aware support.
10+
11+
See MPIX_Query_cuda_support(3) for more details.
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
.\" Copyright 2007-2010 Oracle and/or its affiliates. All rights reserved.
2+
.\" Copyright (c) 1996 Thinking Machines Corporation
3+
.\" Copyright (c) 2010 Cisco Systems, Inc. All rights reserved.
4+
.\" Copyright (c) 2015 NVIDIA, Inc. All rights reserved.
5+
.TH MPIx_CUDA_SUPPORT 3 "#OMPI_DATE#" "#PACKAGE_VERSION#" "#PACKAGE_NAME#"
6+
.SH NAME
7+
\fBMPIX_Query_cuda_support\fP \- Returns 1 if there is CUDA aware support and 0 if there is not.
8+
9+
.SH SYNTAX
10+
.ft R
11+
.SH C Syntax
12+
.nf
13+
#include <mpi.h>
14+
#include <mpi-ext.h>
15+
16+
int MPIX_Query_cuda_support(void)
17+
.fi
18+
.SH Fortran Syntax
19+
There is no Fortran binding for this function.
20+
.
21+
.SH C++ Syntax
22+
There is no C++ binding for this function.
23+
.
24+
.SH DESCRIPTION
25+
.ft R
26+
27+
.SH Examples
28+
.ft R
29+
30+
.SH See Also
31+
.ft R
32+
.nf
33+
34+
.fi

ompi/mpiext/cuda/c/Makefile.am

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
#
2+
# Copyright (c) 2004-2009 The Trustees of Indiana University and Indiana
3+
# University Research and Technology
4+
# Corporation. All rights reserved.
5+
# Copyright (c) 2010-2014 Cisco Systems, Inc. All rights reserved.
6+
# Copyright (c) 2015 NVIDIA, Inc. All rights reserved.
7+
# $COPYRIGHT$
8+
#
9+
# Additional copyrights may follow
10+
#
11+
# $HEADER$
12+
#
13+
14+
# This file builds the C bindings for MPI extensions. It must be
15+
# present in all MPI extensions.
16+
17+
# We must set these #defines so that the inner OMPI MPI prototype
18+
# header files do the Right Thing.
19+
AM_CPPFLAGS = -DOMPI_PROFILE_LAYER=0 -DOMPI_COMPILING_FORTRAN_WRAPPERS=1
20+
21+
include $(top_srcdir)/Makefile.ompi-rules
22+
23+
# Convenience libtool library that will be slurped up into libmpi.la.
24+
noinst_LTLIBRARIES = libmpiext_cuda_c.la
25+
26+
# This is where the top-level header file (that is included in
27+
# <mpi-ext.h>) must be installed.
28+
ompidir = $(ompiincludedir)/ompi/mpiext/cuda/c
29+
30+
# This is the header file that is installed.
31+
ompi_HEADERS = mpiext_cuda_c.h
32+
33+
# Sources for the convenience libtool library. Other than the one
34+
# header file, all source files in the extension have no file naming
35+
# conventions.
36+
libmpiext_cuda_c_la_SOURCES = \
37+
$(ompi_HEADERS) \
38+
mpiext_cuda.c
39+
libmpiext_cuda_c_la_LDFLAGS = -module -avoid-version
40+
41+
# Man page installation
42+
nodist_man_MANS = MPIX_Query_cuda_support.3
43+
44+
# Man page sources
45+
EXTRA_DIST = $(nodist_man_MANS:.3=.3in)
46+
47+
distclean-local:
48+
rm -f $(nodist_man_MANS)

ompi/mpiext/cuda/c/mpiext_cuda.c

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/*
2+
* Copyright (c) 2004-2009 The Trustees of Indiana University and Indiana
3+
* University Research and Technology
4+
* Corporation. All rights reserved.
5+
* Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved.
6+
* Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved.
7+
* Copyright (c) 2012 Los Alamos National Security, LLC. All rights
8+
* reserved.
9+
* Copyright (c) 2015 NVIDIA, Inc. All rights reserved.
10+
* $COPYRIGHT$
11+
*
12+
* Additional copyrights may follow
13+
*
14+
* $HEADER$
15+
*
16+
*/
17+
18+
#include "ompi_config.h"
19+
20+
#include <stdio.h>
21+
#include <string.h>
22+
23+
#include "opal/constants.h"
24+
#include "ompi/mpiext/cuda/c/mpiext_cuda_c.h"
25+
26+
/* The fact that this code is configured and compiled means that we have CUDA aware
27+
support. We may expand on this API to return more features in the future. */
28+
int MPIX_Query_cuda_support(void)
29+
{
30+
return OPAL_SUCCESS;
31+
}

ompi/mpiext/cuda/c/mpiext_cuda_c.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/*
2+
* Copyright (c) 2004-2009 The Trustees of Indiana University.
3+
* All rights reserved.
4+
* Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved.
5+
* Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved.
6+
* Copyright (c) 2015 NVIDIA, Inc. All rights reserved.
7+
* $COPYRIGHT$
8+
*
9+
* Additional copyrights may follow
10+
*
11+
* $HEADER$
12+
*
13+
*/
14+
15+
#define MPIX_CUDA_AWARE_SUPPORT 1
16+
OMPI_DECLSPEC int MPIX_Query_cuda_support(void);

ompi/mpiext/cuda/configure.m4

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# -*- shell-script -*-
2+
#
3+
# Copyright (c) 2004-2010 The Trustees of Indiana University.
4+
# All rights reserved.
5+
# Copyright (c) 2012-2015 Cisco Systems, Inc. All rights reserved.
6+
# Copyright (c) 2015 Intel, Inc. All rights reserved.
7+
# Copyright (c) 2015 NVIDIA, Inc. All rights reserved.
8+
# $COPYRIGHT$
9+
#
10+
# Additional copyrights may follow
11+
#
12+
# $HEADER$
13+
#
14+
15+
# OMPI_MPIEXT_cuda_CONFIG([action-if-found], [action-if-not-found])
16+
# -----------------------------------------------------------
17+
AC_DEFUN([OMPI_MPIEXT_cuda_CONFIG],[
18+
AC_CONFIG_FILES([ompi/mpiext/cuda/Makefile])
19+
AC_CONFIG_FILES([ompi/mpiext/cuda/c/Makefile])
20+
21+
OPAL_VAR_SCOPE_PUSH([ompi_mpi_ext_cuda_happy])
22+
23+
# If we don't want CUDA, don't compile this extention
24+
AS_IF([test "$ENABLE_cuda" = "1" || \
25+
test "$ENABLE_EXT_ALL" = "1"],
26+
[ompi_mpi_ext_cuda_happy=1],
27+
[ompi_mpi_ext_cuda_happy=0])
28+
29+
AS_IF([test "$ompi_mpi_ext_cuda_happy" = "1" && \
30+
test "$CUDA_SUPPORT" = "1"],
31+
[$1],
32+
[ # Error if the user specifically asked for this extension,
33+
# but we can't build it.
34+
AS_IF([test "$ENABLE_cuda" = "1"],
35+
[AC_MSG_WARN([Requested "cuda" MPI extension, but cannot build it])
36+
AC_MSG_WARN([because cuda support is not enabled.])
37+
AC_MSG_WARN([Try again with --with-cuda])
38+
AC_MSG_ERROR([Cannot continue])])
39+
$2])
40+
41+
OPAL_VAR_SCOPE_POP
42+
])

0 commit comments

Comments
 (0)