Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
asapo
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Joao Alvim Oliveira Dias De Almeida
asapo
Commits
402bc6bc
Commit
402bc6bc
authored
4 years ago
by
Carsten Patzke
Browse files
Options
Downloads
Patches
Plain Diff
Added env ASAPO_LIBFABRIC_LIBRARY to override lib path
parent
c7161722
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
common/cpp/src/asapo_fabric/asapo_fabric.cpp
+26
-15
26 additions, 15 deletions
common/cpp/src/asapo_fabric/asapo_fabric.cpp
with
26 additions
and
15 deletions
common/cpp/src/asapo_fabric/asapo_fabric.cpp
+
26
−
15
View file @
402bc6bc
...
...
@@ -4,6 +4,7 @@
#ifdef LIBFABRIC_ENABLED
#include
<dlfcn.h>
#include
<mutex>
#include
<iostream>
#include
"fabric_factory_impl.h"
#include
"fabric_function_map.h"
#endif
...
...
@@ -19,26 +20,36 @@ std::unique_ptr<FabricFactory> asapo::fabric::GenerateDefaultFabricFactory() {
return
std
::
unique_ptr
<
FabricFactory
>
(
new
FabricFactoryImpl
());
}
void
*
handle
=
dlopen
(
"libfabric.so.1"
,
RTLD_LAZY
);
if
(
handle
)
{
const
char
*
libfabric_path_override
=
std
::
getenv
(
"ASAPO_LIBFABRIC_LIBRARY"
);
void
*
handle
=
nullptr
;
if
(
libfabric_path_override
)
{
handle
=
dlopen
(
libfabric_path_override
,
RTLD_LAZY
);
if
(
!
handle
)
{
std
::
cerr
<<
"WARN: 'ASAPO_LIBFABRIC_LIBRARY' was set, but failed to open. Reason: '"
<<
dlerror
()
<<
"'. Fallback to normal path."
<<
std
::
endl
;
}
}
if
(
!
handle
)
{
handle
=
dlopen
(
"libfabric.so.1"
,
RTLD_LAZY
);
// Try release v1.xx
}
if
(
!
handle
)
{
return
std
::
unique_ptr
<
FabricFactory
>
(
new
FabricFactoryNotSupported
(
FabricErrorTemplates
::
kLibraryNotFoundError
));
}
#define ADD_FABRIC_CALL(fName) do { if (!(*((void**)&gffm().fName) = dlsym(handle, #fName))) goto functionNotFoundError; } while(0)
ADD_FABRIC_CALL
(
fi_version
);
ADD_FABRIC_CALL
(
fi_dupinfo
);
ADD_FABRIC_CALL
(
fi_freeinfo
);
ADD_FABRIC_CALL
(
fi_getinfo
);
ADD_FABRIC_CALL
(
fi_fabric
);
ADD_FABRIC_CALL
(
fi_strerror
);
ADD_FABRIC_CALL
(
fi_version
);
ADD_FABRIC_CALL
(
fi_dupinfo
);
ADD_FABRIC_CALL
(
fi_freeinfo
);
ADD_FABRIC_CALL
(
fi_getinfo
);
ADD_FABRIC_CALL
(
fi_fabric
);
ADD_FABRIC_CALL
(
fi_strerror
);
#undef ADD_FABRIC_CALL
gffm
().
is_init_
=
true
;
gffm
().
is_init_
=
true
;
return
std
::
unique_ptr
<
FabricFactory
>
(
new
FabricFactoryImpl
());
return
std
::
unique_ptr
<
FabricFactory
>
(
new
FabricFactoryImpl
());
functionNotFoundError
:
dlclose
(
handle
);
return
std
::
unique_ptr
<
FabricFactory
>
(
new
FabricFactoryNotSupported
(
FabricErrorTemplates
::
kLibraryCompatibilityError
));
}
else
{
return
std
::
unique_ptr
<
FabricFactory
>
(
new
FabricFactoryNotSupported
(
FabricErrorTemplates
::
kLibraryNotFoundError
));
}
dlclose
(
handle
);
return
std
::
unique_ptr
<
FabricFactory
>
(
new
FabricFactoryNotSupported
(
FabricErrorTemplates
::
kLibraryCompatibilityError
));
#endif
return
std
::
unique_ptr
<
FabricFactory
>
(
new
FabricFactoryNotSupported
(
FabricErrorTemplates
::
kNotSupportedOnBuildError
));
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment