-
Notifications
You must be signed in to change notification settings - Fork 937
oshmem: sshmem: adds UCX allocator #2717
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
oshmem: sshmem: add UCX allocator
Signed-off-by: Alex Mikheev <[email protected]>
- Loading branch information
commit 132fbd9ae98eca66f0d6c0d33fa4d76b6b0d3c29
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| # Copyright (c) 2014 Mellanox Technologies, Inc. | ||
| # All rights reserved. | ||
| # $COPYRIGHT$ | ||
| # | ||
| # Additional copyrights may follow | ||
| # | ||
| # $HEADER$ | ||
| # | ||
|
|
||
| #dist_oshmemdata_DATA = help-oshmem-sshmem-mmap.txt | ||
|
|
||
| AM_CPPFLAGS = $(sshmem_ucx_CPPFLAGS) | ||
|
|
||
| sources = \ | ||
| sshmem_ucx.h \ | ||
| sshmem_ucx_component.c \ | ||
| sshmem_ucx_module.c | ||
|
|
||
| # Make the output library in this directory, and name it either | ||
| # mca_<type>_<name>.la (for DSO builds) or libmca_<type>_<name>.la | ||
| # (for static builds). | ||
|
|
||
| if MCA_BUILD_oshmem_sshmem_ucx_DSO | ||
| component_noinst = | ||
| component_install = mca_sshmem_ucx.la | ||
| else | ||
| component_noinst = libmca_sshmem_ucx.la | ||
| component_install = | ||
| endif | ||
|
|
||
| mcacomponentdir = $(oshmemlibdir) | ||
| mcacomponent_LTLIBRARIES = $(component_install) | ||
| mca_sshmem_ucx_la_SOURCES = $(sources) | ||
| mca_sshmem_ucx_la_LDFLAGS = -module -avoid-version $(sshmem_ucx_LDFLAGS) | ||
| mca_sshmem_ucx_la_LIBADD = $(sshmem_ucx_LIBS) | ||
|
|
||
| noinst_LTLIBRARIES = $(component_noinst) | ||
| libmca_sshmem_ucx_la_SOURCES =$(sources) | ||
| libmca_sshmem_ucx_la_LDFLAGS = -module -avoid-version $(sshmem_ucx_LDFLAGS) | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| /* | ||
| * Copyright (c) 2017 Mellanox Technologies, Inc. | ||
| * All rights reserved. | ||
| * $COPYRIGHT$ | ||
| * | ||
| * Additional copyrights may follow | ||
| * | ||
| * $HEADER$ | ||
| */ | ||
|
|
||
| # MCA_oshmem_sshmem_ucx_CONFIG([action-if-can-compile], | ||
| # [action-if-cant-compile]) | ||
| # ------------------------------------------------ | ||
| AC_DEFUN([MCA_oshmem_sshmem_ucx_CONFIG],[ | ||
| AC_CONFIG_FILES([oshmem/mca/sshmem/ucx/Makefile]) | ||
|
|
||
| OMPI_CHECK_UCX([sshmem_ucx], | ||
| [sshmem_ucx_happy="yes"], | ||
| [sshmem_ucx_happy="no"]) | ||
|
|
||
| AS_IF([test "$sshmem_ucx_happy" = "yes"], | ||
| [$1], | ||
| [$2]) | ||
|
|
||
|
|
||
| # substitute in the things needed to build ucx | ||
| AC_SUBST([sshmem_ucx_CFLAGS]) | ||
| AC_SUBST([sshmem_ucx_CPPFLAGS]) | ||
| AC_SUBST([sshmem_ucx_LDFLAGS]) | ||
| AC_SUBST([sshmem_ucx_LIBS]) | ||
| ])dnl | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| /* | ||
| * Copyright (c) 2017 Mellanox Technologies, Inc. | ||
| * All rights reserved. | ||
| * $COPYRIGHT$ | ||
| * | ||
| * Additional copyrights may follow | ||
| * | ||
| * $HEADER$ | ||
| */ | ||
|
|
||
| #ifndef MCA_SSHMEM_UCX_EXPORT_H | ||
| #define MCA_SSHMEM_UCX_EXPORT_H | ||
|
|
||
| #include "oshmem_config.h" | ||
|
|
||
| #include "oshmem/mca/sshmem/sshmem.h" | ||
|
|
||
| BEGIN_C_DECLS | ||
|
|
||
| /** | ||
| * globally exported variable to hold the ucx component. | ||
| */ | ||
| typedef struct mca_sshmem_ucx_component_t { | ||
| /* base component struct */ | ||
| mca_sshmem_base_component_t super; | ||
| /* priority for ucx component */ | ||
| int priority; | ||
| } mca_sshmem_ucx_component_t; | ||
|
|
||
| OSHMEM_MODULE_DECLSPEC extern mca_sshmem_ucx_component_t | ||
| mca_sshmem_ucx_component; | ||
|
|
||
| typedef struct mca_sshmem_ucx_module_t { | ||
| mca_sshmem_base_module_t super; | ||
| } mca_sshmem_ucx_module_t; | ||
| extern mca_sshmem_ucx_module_t mca_sshmem_ucx_module; | ||
|
|
||
| END_C_DECLS | ||
|
|
||
| #endif /* MCA_SHMEM_UCX_EXPORT_H */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,129 @@ | ||
| /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ | ||
| /* | ||
| * Copyright (c) 2017 Mellanox Technologies, Inc. | ||
| * All rights reserved. | ||
| * $COPYRIGHT$ | ||
| * | ||
| * Additional copyrights may follow | ||
| * | ||
| * $HEADER$ | ||
| */ | ||
|
|
||
| #include "oshmem_config.h" | ||
|
|
||
| #include "opal/constants.h" | ||
|
|
||
| #include "oshmem/mca/sshmem/sshmem.h" | ||
| #include "oshmem/mca/sshmem/base/base.h" | ||
| #include "oshmem/mca/spml/base/base.h" | ||
|
|
||
| #include "sshmem_ucx.h" | ||
|
|
||
| /** | ||
| * public string showing the shmem ompi_ucx component version number | ||
| */ | ||
| const char *mca_sshmem_ucx_component_version_string = | ||
| "OSHMEM ucx sshmem MCA component version " OSHMEM_VERSION; | ||
|
|
||
|
|
||
| /** | ||
| * local functions | ||
| */ | ||
| static int ucx_register(void); | ||
| static int ucx_open(void); | ||
| static int ucx_close(void); | ||
| static int ucx_query(mca_base_module_t **module, int *priority); | ||
| static int ucx_runtime_query(mca_base_module_t **module, | ||
| int *priority, | ||
| const char *hint); | ||
|
|
||
| /** | ||
| * instantiate the public struct with all of our public information | ||
| * and pointers to our public functions in it | ||
| */ | ||
| mca_sshmem_ucx_component_t mca_sshmem_ucx_component = { | ||
| /* ////////////////////////////////////////////////////////////////////// */ | ||
| /* super */ | ||
| /* ////////////////////////////////////////////////////////////////////// */ | ||
| { | ||
| /** | ||
| * common MCA component data | ||
| */ | ||
| .base_version = { | ||
| MCA_SSHMEM_BASE_VERSION_2_0_0, | ||
|
|
||
| /* component name and version */ | ||
| .mca_component_name = "ucx", | ||
| MCA_BASE_MAKE_VERSION(component, OSHMEM_MAJOR_VERSION, OSHMEM_MINOR_VERSION, | ||
| OSHMEM_RELEASE_VERSION), | ||
|
|
||
| .mca_open_component = ucx_open, | ||
| .mca_close_component = ucx_close, | ||
| .mca_query_component = ucx_query, | ||
| .mca_register_component_params = ucx_register, | ||
| }, | ||
| /* MCA v2.0.0 component meta data */ | ||
| .base_data = { | ||
| /* the component is checkpoint ready */ | ||
| MCA_BASE_METADATA_PARAM_CHECKPOINT | ||
| }, | ||
| .runtime_query = ucx_runtime_query, | ||
| }, | ||
| }; | ||
|
|
||
| static int | ||
| ucx_runtime_query(mca_base_module_t **module, | ||
| int *priority, | ||
| const char *hint) | ||
| { | ||
| /* check that spml ucx was selected. Otherwise disqualify */ | ||
| if (strcmp(mca_spml_base_selected_component.spmlm_version.mca_component_name, "ucx")) { | ||
| *module = NULL; | ||
| return OSHMEM_ERR_NOT_AVAILABLE; | ||
| } | ||
|
|
||
| *priority = mca_sshmem_ucx_component.priority; | ||
| /* use lowest priority because UCX does not support | ||
| * fixed address mapping yet | ||
| */ | ||
| *priority = 0; | ||
| *module = (mca_base_module_t *)&mca_sshmem_ucx_module.super; | ||
| return OPAL_SUCCESS; | ||
| } | ||
|
|
||
| static int | ||
| ucx_register(void) | ||
| { | ||
| /* (default) priority - set high to make ucx the default */ | ||
| mca_sshmem_ucx_component.priority = 100; | ||
| mca_base_component_var_register (&mca_sshmem_ucx_component.super.base_version, | ||
| "priority", "Priority for sshmem ucx " | ||
| "component (default: 100)", MCA_BASE_VAR_TYPE_INT, | ||
| NULL, 0, MCA_BASE_VAR_FLAG_SETTABLE, | ||
| OPAL_INFO_LVL_3, | ||
| MCA_BASE_VAR_SCOPE_ALL_EQ, | ||
| &mca_sshmem_ucx_component.priority); | ||
|
|
||
| return OSHMEM_SUCCESS; | ||
| } | ||
|
|
||
| static int | ||
| ucx_open(void) | ||
| { | ||
| return OSHMEM_SUCCESS; | ||
| } | ||
|
|
||
| static int | ||
| ucx_query(mca_base_module_t **module, int *priority) | ||
| { | ||
| *priority = mca_sshmem_ucx_component.priority; | ||
| *module = (mca_base_module_t *)&mca_sshmem_ucx_module.super; | ||
| return OSHMEM_SUCCESS; | ||
| } | ||
|
|
||
| static int | ||
| ucx_close(void) | ||
| { | ||
| return OSHMEM_SUCCESS; | ||
| } | ||
|
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what if segno is invalid?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is always valid because the register function is only called for memory segments that were already allocated and belong to the memheap.