-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* re-org python module * update import path * run _load_clib('libkungfu') manually * cleanup scripts * remove RPATH * fix import
- Loading branch information
Showing
25 changed files
with
74 additions
and
177 deletions.
There are no files selected for viewing
This file contains 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 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 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 was deleted.
Oops, something went wrong.
This file contains 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 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 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 was deleted.
Oops, something went wrong.
This file contains 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 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 was deleted.
Oops, something went wrong.
This file contains 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 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 @@ | ||
from .ext import current_cluster_size, current_rank, run_barrier |
This file contains 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,30 @@ | ||
from .loader import _call_method, _load_clib, _module_path | ||
|
||
|
||
def _load_and_init_python_lib(): | ||
_load_clib('libkungfu') | ||
_python_lib = _load_clib('libkungfu_python') | ||
_call_method(_python_lib, 'kungfu_python_init') | ||
has_gpu = _call_method(_python_lib, 'kungfu_python_init_gpu') | ||
return _python_lib, has_gpu | ||
|
||
|
||
_python_lib, _has_gpu = _load_and_init_python_lib() | ||
|
||
|
||
def current_rank(): | ||
return _python_lib.kungfu_rank() | ||
|
||
|
||
def current_cluster_size(): | ||
return _python_lib.kungfu_cluster_size() | ||
|
||
|
||
def run_barrier(): | ||
_python_lib.kungfu_barrier() | ||
|
||
|
||
def _get_other_ranks(): | ||
self_rank = current_rank() | ||
ranks = list(range(current_cluster_size())) | ||
return [r for r in ranks if r != self_rank] |
This file contains 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 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 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,21 @@ | ||
import os | ||
import sysconfig | ||
|
||
from kungfu.loader import _module_path | ||
|
||
EXT_SUFFIX_KEY = 'SO' # 'EXT_SUFFIX' does't work for python2 | ||
|
||
|
||
def _load_op_lib(name): | ||
suffix = sysconfig.get_config_var(EXT_SUFFIX_KEY) | ||
filename = os.path.join(_module_path(), name + suffix) | ||
import tensorflow as tf | ||
return tf.load_op_library(filename) | ||
|
||
|
||
def _load_and_init_op_lib(): | ||
_op_lib = _load_op_lib('kungfu_tensorflow_ops') | ||
return _op_lib | ||
|
||
|
||
_op_lib = _load_and_init_op_lib() |
This file contains 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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
import os | ||
|
||
from .loader import _op_lib, _python_lib | ||
from ._tf_oplib import _op_lib | ||
|
||
|
||
def get_init_checkpoint(): | ||
|
This file contains 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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
from .loader import _op_lib | ||
from ._tf_oplib import _op_lib | ||
from .topology import peer_info | ||
|
||
|
||
|
This file was deleted.
Oops, something went wrong.
This file contains 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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
from .loader import _op_lib | ||
from ._tf_oplib import _op_lib | ||
|
||
|
||
def save_variable(t, version=None): | ||
|
This file contains 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 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 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 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