1
1
openmpi/config/opal_check_cma.m4

137 lines
4.0 KiB
Plaintext
Raw Normal View History

# -*- shell-script -*-
#
# Copyright (c) 2009 The University of Tennessee and The University
# of Tennessee Research Foundation. All rights
# reserved.
# Copyright (c) 2009-2016 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2010-2012 IBM Corporation. All rights reserved.
# Copyright (c) 2013-2016 Los Alamos National Security, LLC. All rights
# reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
George did the work and deserves all the credit for it. Ralph did the merge, and deserves whatever blame results from errors in it :-) WHAT: Open our low-level communication infrastructure by moving all necessary components (btl/rcache/allocator/mpool) down in OPAL All the components required for inter-process communications are currently deeply integrated in the OMPI layer. Several groups/institutions have express interest in having a more generic communication infrastructure, without all the OMPI layer dependencies. This communication layer should be made available at a different software level, available to all layers in the Open MPI software stack. As an example, our ORTE layer could replace the current OOB and instead use the BTL directly, gaining access to more reactive network interfaces than TCP. Similarly, external software libraries could take advantage of our highly optimized AM (active message) communication layer for their own purpose. UTK with support from Sandia, developped a version of Open MPI where the entire communication infrastucture has been moved down to OPAL (btl/rcache/allocator/mpool). Most of the moved components have been updated to match the new schema, with few exceptions (mainly BTLs where I have no way of compiling/testing them). Thus, the completion of this RFC is tied to being able to completing this move for all BTLs. For this we need help from the rest of the Open MPI community, especially those supporting some of the BTLs. A non-exhaustive list of BTLs that qualify here is: mx, portals4, scif, udapl, ugni, usnic. This commit was SVN r32317.
2014-07-26 04:47:28 +04:00
# OPAL_CHECK_CMA(prefix, [action-if-found], [action-if-not-found])
# --------------------------------------------------------
# check if cma support is wanted.
George did the work and deserves all the credit for it. Ralph did the merge, and deserves whatever blame results from errors in it :-) WHAT: Open our low-level communication infrastructure by moving all necessary components (btl/rcache/allocator/mpool) down in OPAL All the components required for inter-process communications are currently deeply integrated in the OMPI layer. Several groups/institutions have express interest in having a more generic communication infrastructure, without all the OMPI layer dependencies. This communication layer should be made available at a different software level, available to all layers in the Open MPI software stack. As an example, our ORTE layer could replace the current OOB and instead use the BTL directly, gaining access to more reactive network interfaces than TCP. Similarly, external software libraries could take advantage of our highly optimized AM (active message) communication layer for their own purpose. UTK with support from Sandia, developped a version of Open MPI where the entire communication infrastucture has been moved down to OPAL (btl/rcache/allocator/mpool). Most of the moved components have been updated to match the new schema, with few exceptions (mainly BTLs where I have no way of compiling/testing them). Thus, the completion of this RFC is tied to being able to completing this move for all BTLs. For this we need help from the rest of the Open MPI community, especially those supporting some of the BTLs. A non-exhaustive list of BTLs that qualify here is: mx, portals4, scif, udapl, ugni, usnic. This commit was SVN r32317.
2014-07-26 04:47:28 +04:00
AC_DEFUN([OPAL_CHECK_CMA],[
AC_ARG_WITH([cma],
[AC_HELP_STRING([--with-cma],
[Build Cross Memory Attach support (default: autodetect)])])
if test "x$with_cma" = "xno" ; then
opal_check_cma_happy=0
fi
# We only need to do the back-end test once
if test -z "$opal_check_cma_happy" ; then
OPAL_CHECK_CMA_BACKEND
fi
AS_IF([test $opal_check_cma_happy -eq 1],
[$2],
[if test "$with_cma" = "yes"; then
AC_MSG_WARN([--with-cma support requested, but not available])
AC_MSG_ERROR([Cannot continue])
fi
$3])
])
AC_DEFUN([OPAL_CHECK_CMA_BACKEND],
[
OPAL_VAR_SCOPE_PUSH([opal_check_cma_need_defs opal_check_cma_kernel_version opal_check_cma_CFLAGS opal_check_cma_msg])
# Some systems have process_cm_readv() in libc, which means CMA is
# supported. Other systems do not have process_cm_readv() in
# libc, but have support for it in the kernel if we invoke it
# directly. Check for both.
AC_CHECK_HEADERS([sys/prctl.h])
AC_CHECK_FUNC([process_vm_readv], [opal_check_cma_need_defs=0],
[opal_check_cma_need_defs=1])
AC_DEFINE_UNQUOTED([OPAL_CMA_NEED_SYSCALL_DEFS],
[$opal_check_cma_need_defs],
[Need CMA syscalls defined])
if test $opal_check_cma_need_defs -eq 1 ; then
opal_check_cma_CFLAGS=$CFLAGS
# Need some extra include paths to locate the appropriate headers
CFLAGS="$CFLAGS -I${srcdir} -I${srcdir}/opal/include"
AC_MSG_CHECKING([if internal syscall numbers for Linux CMA work])
AC_RUN_IFELSE([AC_LANG_PROGRAM([[
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <unistd.h>
#include <sys/uio.h>
#include <sys/wait.h>
#include <sys/syscall.h>
#include "opal/include/opal/sys/cma.h"
static void do_check (pid_t pid, int *in, int *out)
{
int check[4] = {0, 0, 0, 0}, i;
struct iovec rem_iov = {out, sizeof (check)};
struct iovec loc_iov = {check, sizeof (check)};
ssize_t rc;
rc = process_vm_readv (pid, &loc_iov, 1, &rem_iov, 1, 0);
if (sizeof (check) != rc) {
exit (1);
}
for (i = 0 ; i < 4 ; ++i) {
if (check[i] != i) {
exit (1);
}
check[i] = i * 2;
}
rem_iov.iov_base = in;
rc = process_vm_writev (pid, &loc_iov, 1, &rem_iov, 1, 0);
if (sizeof (check) != rc) {
exit (1);
}
exit (0);
}
]],[[
int i, in[4] = {-1, -1, -1, -1}, out[4] = {0, 1, 2, 3};
do_check (getpid (), in, out);
for (i = 0 ; i < 4 ; ++i) {
if (in[i] != 2 * i) {
return 1;
}
}
/* all good */
return 0;
]])],
[AC_MSG_RESULT([yes])
opal_check_cma_happy=1],
[AC_MSG_RESULT([no])
opal_check_cma_happy=0],
[AC_MSG_RESULT([no (cross-compiling)])
opal_check_cma_happy=0])
CFLAGS=$opal_check_cma_CFLAGS
else
# If we didn't need the defs, then we have process_vm_readv(),
# and CMA is happy.
opal_check_cma_happy=1
fi
OPAL_VAR_SCOPE_POP
AS_IF([test $opal_check_cma_happy -eq 1],
[opal_check_cma_msg=yes],
[opal_check_cma_msg=no])
OPAL_SUMMARY_ADD([[Transports]],[[Shared memory/Linux CMA]],[$1],[$opal_check_cma_msg])
])