Commit 58891c23 authored by zhuwenwen's avatar zhuwenwen
Browse files

add dcu version and change readme

parent 0607ee4d
This diff is collapsed.
...@@ -31,12 +31,12 @@ pip install setuptools=59.5.0 wheel ...@@ -31,12 +31,12 @@ pip install setuptools=59.5.0 wheel
```shell ```shell
git clone -b dtk-23.04_openfold1.0.1 https://developer.hpccube.com/codes/aicomponent/openfold git clone -b dtk-23.04_openfold1.0.1 https://developer.hpccube.com/codes/aicomponent/openfold
cd openfold cd openfold
export OPENFOLD_BUILD_VERSION=abix.dtkxxx
python setup.py bdist_wheel python setup.py bdist_wheel
pip install dist/openfold* pip install dist/openfold*
``` ```
## Note ## Note
+ 若使用 pip install 下载安装过慢,可添加源:-i https://pypi.tuna.tsinghua.edu.cn/simple/ + 若使用 pip install 下载安装过慢,可添加源:-i https://pypi.tuna.tsinghua.edu.cn/simple/
+ OPENFOLD_BUILD_VERSION为编译的版本号设置,版本号为1.0.1+gitxxx.abix.dtkxxx
gitxxx:为代码自动获取;abi0:使用devtools的gcc编译;abi1:使用非devtools的gcc编译; dtkxxx为dtk的版本号:例如:dtk2304 ## 参考
\ No newline at end of file - [README_ORIGIN](README_ORIGIN.md)
\ No newline at end of file
This diff is collapsed.
...@@ -16,6 +16,7 @@ import os ...@@ -16,6 +16,7 @@ import os
from setuptools import setup, Extension, find_packages from setuptools import setup, Extension, find_packages
import subprocess import subprocess
import torch
from torch.utils.cpp_extension import BuildExtension, CUDAExtension, ROCM_HOME from torch.utils.cpp_extension import BuildExtension, CUDAExtension, ROCM_HOME
from typing import Optional, Union from typing import Optional, Union
...@@ -48,6 +49,17 @@ def get_sha(root: Union[str, Path]) -> str: ...@@ -48,6 +49,17 @@ def get_sha(root: Union[str, Path]) -> str:
return 'Unknown' return 'Unknown'
def get_abi():
try:
command = "echo '#include <string>' | gcc -x c++ -E -dM - | fgrep _GLIBCXX_USE_CXX11_ABI"
result = subprocess.run(command, shell=True, capture_output=True, text=True)
output = result.stdout.strip()
abi = "abi" + output.split(" ")[-1]
return abi
except Exception:
return 'abiUnknown'
def get_version_add(sha: Optional[str] = None) -> str: def get_version_add(sha: Optional[str] = None) -> str:
openfold_root = os.path.dirname(os.path.abspath(__file__)) openfold_root = os.path.dirname(os.path.abspath(__file__))
add_version_path = "version.py" add_version_path = "version.py"
...@@ -56,12 +68,25 @@ def get_version_add(sha: Optional[str] = None) -> str: ...@@ -56,12 +68,25 @@ def get_version_add(sha: Optional[str] = None) -> str:
sha = get_sha(openfold_root) sha = get_sha(openfold_root)
version = 'git' + sha[:7] version = 'git' + sha[:7]
if os.getenv('OPENFOLD_BUILD_VERSION'): # abi version
version_dtk = os.getenv('OPENFOLD_BUILD_VERSION', "") version += "." + get_abi()
version += "." + version_dtk
# dtk version
if os.getenv("ROCM_PATH"):
rocm_path = os.getenv('ROCM_PATH', "")
rocm_version_path = os.path.join(rocm_path, '.info', "rocm_version")
with open(rocm_version_path, 'r',encoding='utf-8') as file:
lines = file.readlines()
rocm_version=lines[0][:-2].replace(".", "")
version += ".dtk" + rocm_version
# torch version
version += ".torch" + torch.__version__[:4]
with open(add_version_path, encoding="utf-8", mode="w") as file: with open(add_version_path, encoding="utf-8", mode="w") as file:
file.write("__version__='1.0.1'+'+{}'\n".format(version)) # file.write("__version__='1.0.1'+'+{}'\n".format(version))
file.write("__version__='1.0.1'\n")
file.write("__dcu_version__='1.0.1+{}'\n".format(version))
file.close() file.close()
...@@ -70,7 +95,7 @@ def get_version(): ...@@ -70,7 +95,7 @@ def get_version():
version_file = 'version.py' version_file = 'version.py'
with open(version_file, encoding='utf-8') as f: with open(version_file, encoding='utf-8') as f:
exec(compile(f.read(), version_file, 'exec')) exec(compile(f.read(), version_file, 'exec'))
return locals()['__version__'] return locals()['__dcu_version__']
setup( setup(
name='openfold', name='openfold',
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment