From a390a8f5ef98c8007a1e1a547553e0778e030e55 Mon Sep 17 00:00:00 2001 From: Ralph Castain Date: Wed, 24 Jun 2015 20:58:35 -0700 Subject: [PATCH] Add a CUDA MPI extension to provide the MPIx_CUDA_SUPPORT macro --- ompi/mpiext/cuda/Makefile.am | 24 +++++++++++++ ompi/mpiext/cuda/README.txt | 10 ++++++ ompi/mpiext/cuda/c/MPIx_CUDA_SUPPORT.3in | 41 +++++++++++++++++++++ ompi/mpiext/cuda/c/Makefile.am | 45 ++++++++++++++++++++++++ ompi/mpiext/cuda/c/mpiext_cuda.c | 26 ++++++++++++++ ompi/mpiext/cuda/c/mpiext_cuda.h | 15 ++++++++ ompi/mpiext/cuda/configure.m4 | 41 +++++++++++++++++++++ 7 files changed, 202 insertions(+) create mode 100644 ompi/mpiext/cuda/Makefile.am create mode 100644 ompi/mpiext/cuda/README.txt create mode 100644 ompi/mpiext/cuda/c/MPIx_CUDA_SUPPORT.3in create mode 100644 ompi/mpiext/cuda/c/Makefile.am create mode 100644 ompi/mpiext/cuda/c/mpiext_cuda.c create mode 100644 ompi/mpiext/cuda/c/mpiext_cuda.h create mode 100644 ompi/mpiext/cuda/configure.m4 diff --git a/ompi/mpiext/cuda/Makefile.am b/ompi/mpiext/cuda/Makefile.am new file mode 100644 index 0000000000..3d8db46ce9 --- /dev/null +++ b/ompi/mpiext/cuda/Makefile.am @@ -0,0 +1,24 @@ +# +# Copyright (c) 2004-2009 The Trustees of Indiana University and Indiana +# University Research and Technology +# Corporation. All rights reserved. +# Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. +# Copyright (c) 2015 NVIDIA, Inc. All rights reserved +# $COPYRIGHT$ +# +# Additional copyrights may follow +# +# $HEADER$ +# + +# This Makefile is not traversed during a normal "make all" in an OMPI +# build. It *is* traversed during "make dist", however. So you can +# put EXTRA_DIST targets in here. +# +# You can also use this as a convenience for building this MPI +# extension (i.e., "make all" in this directory to invoke "make all" +# in all the subdirectories). + +SUBDIRS = c + +EXTRA_DIST = README.txt diff --git a/ompi/mpiext/cuda/README.txt b/ompi/mpiext/cuda/README.txt new file mode 100644 index 0000000000..59bee5f1e3 --- /dev/null +++ b/ompi/mpiext/cuda/README.txt @@ -0,0 +1,10 @@ +# Copyright (c) 2015 NVIDIA, Inc. All rights reserved. + +$COPYRIGHT$ + +Rolf Vandervart + + +This extension provides a blah blah blah + +See MPIx_CUDA_SUPPORT(3) for more details. diff --git a/ompi/mpiext/cuda/c/MPIx_CUDA_SUPPORT.3in b/ompi/mpiext/cuda/c/MPIx_CUDA_SUPPORT.3in new file mode 100644 index 0000000000..40629b4d4b --- /dev/null +++ b/ompi/mpiext/cuda/c/MPIx_CUDA_SUPPORT.3in @@ -0,0 +1,41 @@ +.\" Copyright 2007-2010 Oracle and/or its affiliates. All rights reserved. +.\" Copyright (c) 1996 Thinking Machines Corporation +.\" Copyright (c) 2010 Cisco Systems, Inc. All rights reserved. +.\" Copyright (c) 2015 NVIDIA, Inc. All rights reserved. +.TH MPIx_CUDA_SUPPORT 3 "#OMPI_DATE#" "#PACKAGE_VERSION#" "#PACKAGE_NAME#" +.SH NAME +\fBMPIx_CUDA_SUPPORT\fP \- Obtain prettyprint strings of processor affinity information for this process + +.SH SYNTAX +.ft R +.SH C Syntax +.nf +#include +#include + +int MPIx_CUDA_SUPPORT(void) +.fi +.SH Fortran Syntax +There is no Fortran binding for this function. +. +.SH C++ Syntax +There is no C++ binding for this function. +. +.SH INPUT PARAMETERS +.ft R +. +.SH OUTPUT PARAMETERS +.ft R +.TP 1i + +.SH DESCRIPTION +.ft R + +.SH Examples +.ft R + +.SH See Also +.ft R +.nf +JeffIsAToad(1) +.fi diff --git a/ompi/mpiext/cuda/c/Makefile.am b/ompi/mpiext/cuda/c/Makefile.am new file mode 100644 index 0000000000..3d68572b8a --- /dev/null +++ b/ompi/mpiext/cuda/c/Makefile.am @@ -0,0 +1,45 @@ +# +# Copyright (c) 2004-2009 The Trustees of Indiana University and Indiana +# University Research and Technology +# Corporation. All rights reserved. +# Copyright (c) 2010-2014 Cisco Systems, Inc. All rights reserved. +# Copyright (c) 2015 NVIDIA, Inc. All rights reserved. +# $COPYRIGHT$ +# +# Additional copyrights may follow +# +# $HEADER$ +# + +# This file builds the C bindings for MPI extensions. It must be +# present in all MPI extensions. + +# We must set these #defines so that the inner OMPI MPI prototype +# header files do the Right Thing. +AM_CPPFLAGS = -DOMPI_PROFILE_LAYER=0 -DOMPI_COMPILING_FORTRAN_WRAPPERS=1 + +include $(top_srcdir)/Makefile.ompi-rules + +# Convenience libtool library that will be slurped up into libmpi.la. +noinst_LTLIBRARIES = libmpiext_cuda.la + +# This is where the top-level header file (that is included in +# ) must be installed. +ompidir = $(ompiincludedir)/ompi/mpiext/cuda/c + +# This is the header file that is installed. +ompi_HEADERS = mpiext_cuda.h + +# Sources for the convenience libtool library. Other than the one +# header file, all source files in the extension have no file naming +# conventions. +libmpiext_cuda_la_SOURCES = \ + $(ompi_HEADERS) \ + mpiext_cuda.c +libmpiext_cuda_la_LDFLAGS = -module -avoid-version + +# Man page installation +nodist_man_MANS = MPIx_CUDA_SUPPORT.3 + +# Man page sources +EXTRA_DIST = $(nodist_man_MANS:.3=.3in) diff --git a/ompi/mpiext/cuda/c/mpiext_cuda.c b/ompi/mpiext/cuda/c/mpiext_cuda.c new file mode 100644 index 0000000000..84817fd28d --- /dev/null +++ b/ompi/mpiext/cuda/c/mpiext_cuda.c @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2004-2009 The Trustees of Indiana University and Indiana + * University Research and Technology + * Corporation. All rights reserved. + * Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012 Los Alamos National Security, LLC. All rights + * reserved. + * Copyright (c) 2015 NVIDIA, Inc. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + * + */ + +#include "ompi_config.h" + +#include +#include + +int MPIx_CUDA_SUPPORT(void) +{ + return OPAL_ERR_NOT_SUPPORTED; +} diff --git a/ompi/mpiext/cuda/c/mpiext_cuda.h b/ompi/mpiext/cuda/c/mpiext_cuda.h new file mode 100644 index 0000000000..dcbcf4ec1b --- /dev/null +++ b/ompi/mpiext/cuda/c/mpiext_cuda.h @@ -0,0 +1,15 @@ +/* + * Copyright (c) 2004-2009 The Trustees of Indiana University. + * All rights reserved. + * Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015 NVIDIA, Inc. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + * + */ + +OMPI_DECLSPEC int MPIx_CUDA_SUPPORT(void); diff --git a/ompi/mpiext/cuda/configure.m4 b/ompi/mpiext/cuda/configure.m4 new file mode 100644 index 0000000000..e146b44741 --- /dev/null +++ b/ompi/mpiext/cuda/configure.m4 @@ -0,0 +1,41 @@ +# -*- shell-script -*- +# +# Copyright (c) 2004-2010 The Trustees of Indiana University. +# All rights reserved. +# Copyright (c) 2012-2015 Cisco Systems, Inc. All rights reserved. +# Copyright (c) 2015 Intel, Inc. All rights reserved. +# $COPYRIGHT$ +# +# Additional copyrights may follow +# +# $HEADER$ +# + +# OMPI_MPIEXT_cuda_CONFIG([action-if-found], [action-if-not-found]) +# ----------------------------------------------------------- +AC_DEFUN([OMPI_MPIEXT_cuda_CONFIG],[ + AC_CONFIG_FILES([ompi/mpiext/cuda/Makefile]) + AC_CONFIG_FILES([ompi/mpiext/cuda/c/Makefile]) + + OPAL_VAR_SCOPE_PUSH([ompi_mpi_ext_cuda_happy]) + + # If we don't want FT, don't compile this extention + AS_IF([test "$ENABLE_cuda" = "1" || \ + test "$ENABLE_EXT_ALL" = "1"], + [ompi_mpi_ext_cuda_happy=1], + [ompi_mpi_ext_cuda_happy=0]) + + AS_IF([test "$ompi_mpi_ext_cuda_happy" = "1" && \ + test "$CUDA_SUPPORT" = "1"], + [$1], + [ # Error if the user specifically asked for this extension, + # but we can't build it. + AS_IF([test "$ENABLE_cuda" = "1"], + [AC_MSG_WARN([Requested "cuda" MPI extension, but cannot build it]) + AC_MSG_WARN([because cuda support is not enabled.]) + AC_MSG_WARN([Try again with --with-cuda]) + AC_MSG_ERROR([Cannot continue])]) + $2]) + + OPAL_VAR_SCOPE_POP +])