Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion config/opal_config_asm.m4
Original file line number Diff line number Diff line change
Expand Up @@ -1374,7 +1374,7 @@ AC_MSG_ERROR([Can not continue.])

# Check for RDTSCP support
result=0
AS_IF([test "$opal_cv_asm_arch" = "OPAL_X86_64" || test "$opal_cv_asm_arch" = "OPAL_IA32"],
AS_IF([test "$opal_cv_asm_arch" = "X86_64" || test "$opal_cv_asm_arch" = "IA32"],
[AC_MSG_CHECKING([for RDTSCP assembly support])
AC_LANG_PUSH([C])
AC_TRY_RUN([[
Expand Down
2 changes: 2 additions & 0 deletions ompi/mca/op/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
# $HEADER$
#

AM_CPPFLAGS = $(LTDLINCL)

# main library setup
noinst_LTLIBRARIES = libmca_op.la
libmca_op_la_SOURCES =
Expand Down
69 changes: 69 additions & 0 deletions ompi/mca/op/avx/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
#
# Copyright (c) 2019 The University of Tennessee and The University
# of Tennessee Research Foundation. All rights
# reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#

# This component provide support for the Advanced Vector Extensions (AVX)
# available in recent versions of x86 processors.
#
# See https://github.com/open-mpi/ompi/wiki/devel-CreateComponent
# for more details on how to make Open MPI components.

# First, list all .h and .c sources. It is necessary to list all .h
# files so that they will be picked up in the distribution tarball.

AM_CPPFLAGS=$(op_avx_CPPFLAGS)

sources = op_avx_component.c op_avx_functions.c \
op_avx_functions.h op_avx.h

# Open MPI components can be compiled two ways:
#
# 1. As a standalone dynamic shared object (DSO), sometimes called a
# dynamically loadable library (DLL).
#
# 2. As a static library that is slurped up into the upper-level
# libmpi library (regardless of whether libmpi is a static or dynamic
# library). This is called a "Libtool convenience library".
#
# The component needs to create an output library in this top-level
# component directory, and named either mca_<type>_<name>.la (for DSO
# builds) or libmca_<type>_<name>.la (for static builds). The OMPI
# build system will have set the
# MCA_BUILD_ompi_<framework>_<component>_DSO AM_CONDITIONAL to indicate
# which way this component should be built.

if MCA_BUILD_ompi_op_avx_DSO
component_noinst =
component_install = mca_op_avx.la
else
component_install =
component_noinst = libmca_op_avx.la
endif

# Specific information for DSO builds.
#
# The DSO should install itself in $(ompilibdir) (by default,
# $prefix/lib/openmpi).

mcacomponentdir = $(ompilibdir)
mcacomponent_LTLIBRARIES = $(component_install)
mca_op_avx_la_SOURCES = $(sources)
mca_op_avx_la_CFLAGS = $(op_avx_CPPFLAGS)
mca_op_avx_la_LDFLAGS = -module -avoid-version

# Specific information for static builds.
#
# Note that we *must* "noinst"; the upper-layer Makefile.am's will
# slurp in the resulting .la library into libmpi.

noinst_LTLIBRARIES = $(component_noinst)
libmca_op_avx_la_SOURCES = $(sources)
libmca_op_avx_la_CFLAGS = $(op_avx_CPPFLAGS)
libmca_op_avx_la_LDFLAGS = -module -avoid-version
67 changes: 67 additions & 0 deletions ompi/mca/op/avx/configure.m4
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# -*- shell-script -*-
#
# Copyright (c) 2019 The University of Tennessee and The University
# of Tennessee Research Foundation. All rights
# reserved.
#
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#

# MCA_ompi_op_avx_CONFIG([action-if-can-compile],
# [action-if-cant-compile])
# ------------------------------------------------
# We can always build, unless we were explicitly disabled.
AC_DEFUN([MCA_ompi_op_avx_CONFIG],[
op_avx_support=0
OPAL_VAR_SCOPE_PUSH([op_avx_cflags_save op_avx_CPPFLAGS])

AS_IF([test "$opal_cv_asm_arch" = "X86_64"],
[AC_LANG_PUSH([C])

# Check for AVX512 support with default flags
op_avx_CPPFLAGS=""
AC_MSG_CHECKING([for AVX512 support (no additional flags)])
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([[#include <immintrin.h>]],
[[
__m512 vA, vB;
_mm512_add_ps(vA, vB)
]])],
[op_avx_support=1
AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])])

AS_IF([test $op_avx_support -eq 0],
[AC_MSG_CHECKING([for AVX512 support (with -march=skylake-avx512)])
op_avx_cflags_save="$CFLAGS"
CFLAGS="$CFLAGS -march=skylake-avx512"
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([[#include <immintrin.h>]],
[[
__m512 vA, vB;
_mm512_add_ps(vA, vB)
]])],
[op_avx_support=1
op_avx_CPPFLAGS="-march=skylake-avx512"
AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])])
CFLAGS="$op_avx_cflags_save"
])
AC_LANG_POP([C])
])

AC_DEFINE_UNQUOTED([OMPI_MCA_OP_HAVE_AVX512],
[$op_avx_support],
[Whetever AVX512 is supported in the current compilation context])
AC_SUBST([op_avx_CPPFLAGS])
OPAL_VAR_SCOPE_POP
AS_IF([test $op_avx_support -eq 1],
[AC_CONFIG_FILES([ompi/mca/op/avx/Makefile])
[$1]],
[$2])

])dnl
58 changes: 58 additions & 0 deletions ompi/mca/op/avx/op_avx.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/*
* Copyright (c) 2019 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/

#ifndef MCA_OP_AVX_EXPORT_H
#define MCA_OP_AVX_EXPORT_H

#include "ompi_config.h"

#include "ompi/mca/mca.h"
#include "opal/class/opal_object.h"

#include "ompi/mca/op/op.h"

BEGIN_C_DECLS

/**
* Derive a struct from the base op component struct, allowing us to
* cache some component-specific information on our well-known
* component struct.
*/
typedef struct {
/** The base op component struct */
ompi_op_base_component_1_0_0_t super;

/* What follows is avx-component-specific cached information. We
tend to use this scheme (caching information on the avx
component itself) instead of lots of individual global
variables for the component. The following data fields are
avxs; replace them with whatever is relevant for your
component. */

/** A simple boolean indicating whether double precision is
supported. */
bool double_supported;
} ompi_op_avx_component_t;

/**
* Globally exported variable. Note that it is a *avx* component
* (defined above), which has the ompi_op_base_component_t as its
* first member. Hence, the MCA/op framework will find the data that
* it expects in the first memory locations, but then the component
* itself can cache additional information after that that can be used
* by both the component and modules.
*/
OMPI_DECLSPEC extern ompi_op_avx_component_t
mca_op_avx_component;

END_C_DECLS

#endif /* MCA_OP_AVX_EXPORT_H */
Loading