Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build plugins as DSOs intead of shared libraries. #378

Merged
merged 2 commits into from
Apr 8, 2024
Merged
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
1 change: 1 addition & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ AC_FUNC_MALLOC
AC_CHECK_FUNC([memset], [], [AC_MSG_ERROR([NCCL OFI Plugin requires memset function.])])
AC_CHECK_FUNC([realpath], [], [AC_MSG_ERROR([NCCL OFI Plugin requires realpath function.])])
AC_SEARCH_LIBS([dlopen], [dl], [], [AC_MSG_ERROR([NCCL OFI Plugin requires dlopen])])
AC_SEARCH_LIBS([pthread_getspecific], [pthread], [], [AC_MSG_ERROR([NCCL OFI Plugin requires pthreads.])])

# Check for GCC builtin functions
CHECK_GCC_BUILTIN([__builtin_expect])
Expand Down
33 changes: 29 additions & 4 deletions src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@

AM_CPPFLAGS = -I$(top_srcdir)/include -DXML_DIR=\"${pkgdatadir}/xml\"

#
# net plugin
#
sources = \
nccl_ofi_api.c \
nccl_ofi_net.c \
Expand All @@ -25,21 +28,43 @@ sources += platform-aws.c
endif

if ENABLE_NEURON
lib_LTLIBRARIES = libnccom-net.la
sources += nccl_ofi_interface_neuron.c
libnccom_net_la_SOURCES = $(sources)
else
lib_LTLIBRARIES = libnccl-net.la
sources += nccl_ofi_cuda.c \
nccl_ofi_interface_nvidia.c
libnccl_net_la_SOURCES = $(sources)
endif

# Build an internal-only library that can be used by unit tests as
# well as the actual nccl_net.so / nccom_net.so libraries. This saves
# us writing dlopen() handlers for simple unit tests.
noinst_LTLIBRARIES = libinternal_net_plugin.la
libinternal_net_plugin_la_SOURCES = $(sources)
libinternal_net_plugin_la_LDFLAGS = -avoid-version

if ENABLE_NEURON
lib_LTLIBRARIES = libnccom-net.la
libnccom_net_la_SOURCES =
libnccom_net_la_LIBADD = libinternal_net_plugin.la
libnccom_net_la_LDFLAGS = -module -avoid-version
else
lib_LTLIBRARIES = libnccl-net.la
libnccl_net_la_SOURCES =
libnccl_net_la_LIBADD = libinternal_net_plugin.la
libnccl_net_la_LDFLAGS = -module -avoid-version
endif


#
# Tuner
#
if HAVE_CUDA
if WANT_PLATFORM_AWS
# NCCL tuner plugin
lib_LTLIBRARIES += libnccl-ofi-tuner.la
tuner_sources = \
tuner/nccl_ofi_model.c \
tuner/nccl_ofi_tuner.c
libnccl_ofi_tuner_la_SOURCES = $(tuner_sources)
libnccl_ofi_tuner_la_LDFLAGS = -module -avoid-version
endif
endif
4 changes: 2 additions & 2 deletions tests/functional/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

AM_CPPFLAGS = -I$(top_srcdir)/include $(MPI_CPPFLAGS)
AM_LDFLAGS = $(MPI_LDFLAGS) $(CUDA_LDFLAGS)
LDADD = $(top_builddir)/src/libnccl-net.la $(MPI_LIBS) $(CUDA_LIBS)
LDADD = $(top_builddir)/src/libinternal_net_plugin.la $(MPI_LIBS) $(CUDA_LIBS)
CC = $(MPICC)

noinst_HEADERS = test-common.h
Expand All @@ -25,4 +25,4 @@ cuda_check_SOURCES = cuda_check.c
# Override the LDADD for this check to avoid the -lcudart used by the
# other tests, since the purpose of this test is to make sure we
# didn't leak direct cuda dependencies into the plugin.
cuda_check_LDADD = $(top_builddir)/src/libnccl-net.la
cuda_check_LDADD = $(top_builddir)/src/libinternal_net_plugin.la
2 changes: 1 addition & 1 deletion tests/unit/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#

AM_CPPFLAGS = -I$(top_srcdir)/include
LDADD = $(top_builddir)/src/lib$(OFI_NCCL_ARCHIVE).la
LDADD = $(top_builddir)/src/libinternal_net_plugin.la

noinst_HEADERS = test-common.h

Expand Down
Loading