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

Fix macOS support and run macOS build in Simple CI #4947

Merged
merged 188 commits into from
Jun 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
188 commits
Select commit Hold shift + click to select a range
475bf4e
update cmake
jackalcooper May 21, 2021
3a23012
check in fix
jackalcooper May 21, 2021
3626331
add default for apple
jackalcooper May 21, 2021
0732ef3
Merge branch 'master' of https://github.com/Oneflow-Inc/oneflow into …
jackalcooper May 22, 2021
fe83c8e
skip and generate_api for in mac ci
jackalcooper May 22, 2021
105110b
fix yml
jackalcooper May 22, 2021
2c01b05
fix has_grad template
strint May 24, 2021
ff7ca89
Merge branch 'master' into fix_hasgrad_template
strint May 24, 2021
3dbbb88
Merge branch 'master' into fix_hasgrad_template
strint May 24, 2021
791e715
Merge branch 'master' into fix_hasgrad_template
oneflow-ci-bot May 24, 2021
5ccf010
Merge branch 'master' into fix_hasgrad_template
oneflow-ci-bot May 24, 2021
c3e5d97
Merge branch 'master' into fix_hasgrad_template
oneflow-ci-bot May 24, 2021
f6398fd
Merge branch 'master' into fix_hasgrad_template
oneflow-ci-bot May 24, 2021
ba33a51
Merge branch 'master' into fix_hasgrad_template
oneflow-ci-bot May 25, 2021
fb4723a
Merge branch 'master' into fix_hasgrad_template
oneflow-ci-bot May 25, 2021
ece4c44
Merge branch 'master' into fix_hasgrad_template
oneflow-ci-bot May 25, 2021
5d3797b
Merge branch 'master' into fix_hasgrad_template
oneflow-ci-bot May 25, 2021
4683806
Merge branch 'master' into fix_hasgrad_template
oneflow-ci-bot May 25, 2021
99e0df9
Merge branch 'master' into fix_hasgrad_template
oneflow-ci-bot May 25, 2021
d533322
Merge branch 'master' into fix_hasgrad_template
oneflow-ci-bot May 25, 2021
ccd676c
Merge branch 'master' into fix_hasgrad_template
oneflow-ci-bot May 25, 2021
7cac6a4
Merge branch 'master' into fix_hasgrad_template
oneflow-ci-bot May 26, 2021
8181c63
Merge branch 'master' into fix_hasgrad_template
oneflow-ci-bot May 26, 2021
6b3bca9
Merge branch 'master' into fix_hasgrad_template
oneflow-ci-bot May 26, 2021
e0de1a6
Merge branch 'master' into fix_hasgrad_template
strint May 26, 2021
91a97de
Merge branch 'master' into fix_hasgrad_template
oneflow-ci-bot May 26, 2021
96c2a71
Merge branch 'master' into fix_hasgrad_template
oneflow-ci-bot May 26, 2021
3663f9d
Merge branch 'master' into fix_hasgrad_template
oneflow-ci-bot May 26, 2021
4b589b6
Merge branch 'master' into fix_hasgrad_template
oneflow-ci-bot May 26, 2021
ab5045e
Merge branch 'master' into fix_hasgrad_template
oneflow-ci-bot May 26, 2021
cb0b2f0
Merge branch 'master' into fix_hasgrad_template
oneflow-ci-bot May 27, 2021
e8aa166
Merge branch 'master' into fix_hasgrad_template
oneflow-ci-bot May 27, 2021
de4af7e
Merge branch 'master' into fix_hasgrad_template
oneflow-ci-bot May 27, 2021
d89f09b
Merge branch 'master' into fix_hasgrad_template
oneflow-ci-bot May 27, 2021
28cf132
update flatbuffer
jackalcooper May 27, 2021
2159ec6
fix align
jackalcooper May 27, 2021
baf5eda
Merge branch 'master' into fix_hasgrad_template
oneflow-ci-bot May 27, 2021
73ecc1c
Merge branch 'fix_hasgrad_template' of https://github.com/Oneflow-Inc…
jackalcooper May 27, 2021
8d5312e
Merge branch 'master' of https://github.com/Oneflow-Inc/oneflow into …
jackalcooper Jun 3, 2021
d87690e
Merge branch 'master' of https://github.com/Oneflow-Inc/oneflow into …
jackalcooper Jun 4, 2021
3d00846
Merge branch 'master' into support_clang
jackalcooper Jun 15, 2021
3a060f9
revert
jackalcooper Jun 15, 2021
55407da
Merge branch 'master' of https://github.com/Oneflow-Inc/oneflow into …
jackalcooper Jun 15, 2021
6dc87d6
revert
jackalcooper Jun 15, 2021
e0bb479
refine
jackalcooper Jun 15, 2021
930e5e0
add FLATBUFFERS_BUILD_TESTS=OFF
jackalcooper Jun 15, 2021
17fe1e3
revert
jackalcooper Jun 15, 2021
fa28ec3
refine
jackalcooper Jun 15, 2021
52809dd
Merge branch 'support_clang' of https://github.com/Oneflow-Inc/oneflo…
jackalcooper Jun 15, 2021
e043da3
add note
jackalcooper Jun 15, 2021
f62f49e
Update flatbuffers.cmake
jackalcooper Jun 15, 2021
d45f820
refine
jackalcooper Jun 15, 2021
fa3cb64
rm log
jackalcooper Jun 15, 2021
e4ebc60
FLATBUFFERS_BUILD_TESTS=OFF
jackalcooper Jun 15, 2021
527c73b
Update flatbuffers.cmake
jackalcooper Jun 15, 2021
1990bcf
Merge branch 'support_clang' of https://github.com/Oneflow-Inc/oneflo…
jackalcooper Jun 15, 2021
5f3bf4d
restore
jackalcooper Jun 15, 2021
d920473
refine
jackalcooper Jun 15, 2021
cd5c83c
fix ndarry std::min
jackalcooper Jun 15, 2021
92651ba
restore
jackalcooper Jun 15, 2021
d1fd9a4
refine
jackalcooper Jun 15, 2021
7835521
Merge branch 'master' into support_clang
oneflow-ci-bot Jun 15, 2021
7597817
Merge branch 'master' into fix_macos_support
jackalcooper Jun 15, 2021
3893cb0
Merge branch 'support_clang' of https://github.com/Oneflow-Inc/oneflo…
jackalcooper Jun 15, 2021
8725341
update test config
jackalcooper Jun 15, 2021
f89c5e5
run doctest in cpu
jackalcooper Jun 15, 2021
5d6e22d
fix vm::TestResourceDescScope
jackalcooper Jun 15, 2021
f098be1
dont run doctest because it seems to involve more
jackalcooper Jun 15, 2021
986ea55
Merge branch 'run_exe_test_in_cpu_only' of https://github.com/Oneflow…
jackalcooper Jun 15, 2021
e1dfe7b
Merge branch 'fix_macos_support' of https://github.com/Oneflow-Inc/on…
jackalcooper Jun 15, 2021
4a5a4be
add simple ci
jackalcooper Jun 15, 2021
6b07b4a
refine
jackalcooper Jun 15, 2021
942017a
refine
jackalcooper Jun 15, 2021
ce2c878
add ubuntu
jackalcooper Jun 15, 2021
8312032
refine
jackalcooper Jun 15, 2021
6e8d24e
refine
jackalcooper Jun 15, 2021
72abc66
add todo
jackalcooper Jun 15, 2021
0a5fc91
refine
jackalcooper Jun 15, 2021
4b0e265
refine cache
jackalcooper Jun 15, 2021
4c476a9
build oneflow if linux
jackalcooper Jun 15, 2021
a90134f
refine
jackalcooper Jun 15, 2021
62708fe
refine
jackalcooper Jun 15, 2021
0104e66
fix cache order
jackalcooper Jun 15, 2021
8284c40
refine cache key
jackalcooper Jun 15, 2021
4049faa
refine
jackalcooper Jun 15, 2021
9cd1bef
Merge branch 'master' of https://github.com/Oneflow-Inc/oneflow into …
jackalcooper Jun 15, 2021
5fc4ace
Merge branch 'master' of https://github.com/Oneflow-Inc/oneflow into …
jackalcooper Jun 17, 2021
06e3f87
rm skip
jackalcooper Jun 17, 2021
099a690
add instruction on readme
jackalcooper Jun 17, 2021
57ca749
refine
jackalcooper Jun 17, 2021
895ccf3
refine
jackalcooper Jun 17, 2021
154b856
revert
jackalcooper Jun 17, 2021
afe60e7
refine
jackalcooper Jun 18, 2021
2f7b14d
refine
jackalcooper Jun 18, 2021
e849bb2
Merge branch 'master' of https://github.com/Oneflow-Inc/oneflow into …
jackalcooper Jun 18, 2021
d888329
refine
jackalcooper Jun 18, 2021
6b747ce
Update CMakeLists.txt
jackalcooper Jun 18, 2021
60c4733
add
jackalcooper Jun 18, 2021
0009912
Fix protobuf debug postfix
liujuncheng Jun 18, 2021
b0ed707
Merge branch 'fix_protobuf_debug_postfix' of https://github.com/Onefl…
jackalcooper Jun 18, 2021
ef19e69
refine
jackalcooper Jun 18, 2021
bbb000f
fix
jackalcooper Jun 18, 2021
028bf86
refine
jackalcooper Jun 18, 2021
b148a4a
Merge branch 'master' of https://github.com/Oneflow-Inc/oneflow into …
jackalcooper Jun 18, 2021
c21dfd3
refine
jackalcooper Jun 18, 2021
9bec8bd
refine
jackalcooper Jun 18, 2021
f1de510
Merge branch 'master' into mv-default-third-party-dir-into-build-dir-1
oneflow-ci-bot Jun 18, 2021
fc1b0d5
refine
jackalcooper Jun 18, 2021
edcff1f
add config in matrix
jackalcooper Jun 18, 2021
c2260ca
refine
jackalcooper Jun 18, 2021
e0713de
refine
jackalcooper Jun 18, 2021
fd6fa2a
refine
jackalcooper Jun 18, 2021
88c963c
fix
jackalcooper Jun 18, 2021
317b6a7
add badge
jackalcooper Jun 18, 2021
7dfba4e
refine
jackalcooper Jun 18, 2021
6b009b9
refine
jackalcooper Jun 18, 2021
166e9bf
refine
jackalcooper Jun 18, 2021
c6b7a85
Merge branch 'master' of https://github.com/Oneflow-Inc/oneflow into …
jackalcooper Jun 18, 2021
0655e23
merge
jackalcooper Jun 18, 2021
64d9c5c
Merge branch 'master' of https://github.com/Oneflow-Inc/oneflow into …
jackalcooper Jun 18, 2021
bfe991a
opencv diable intel ITT
jackalcooper Jun 18, 2021
587bc62
rm RelWithDebInfo
jackalcooper Jun 18, 2021
7b59a48
refine
jackalcooper Jun 18, 2021
6ed3975
refine
jackalcooper Jun 18, 2021
a9b2cd0
Merge branch 'master' of https://github.com/Oneflow-Inc/oneflow into …
jackalcooper Jun 18, 2021
403d308
rm intel ITT
jackalcooper Jun 18, 2021
9555d7a
dont use realpath to prevent failure
jackalcooper Jun 18, 2021
18e6abe
Merge branch 'master' of https://github.com/Oneflow-Inc/oneflow into …
jackalcooper Jun 18, 2021
ed68f01
Merge branch 'master' of https://github.com/Oneflow-Inc/oneflow into …
jackalcooper Jun 18, 2021
196222c
Merge branch 'support_ninja' of https://github.com/Oneflow-Inc/oneflo…
jackalcooper Jun 18, 2021
96dd3f1
refine
jackalcooper Jun 18, 2021
f33b501
Merge branch 'support_ninja' of https://github.com/Oneflow-Inc/oneflo…
jackalcooper Jun 18, 2021
564974d
fix
jackalcooper Jun 18, 2021
86f7567
don't build Ninja with Release to reduce product
jackalcooper Jun 18, 2021
c51596f
revert
jackalcooper Jun 18, 2021
befa080
refine order
jackalcooper Jun 18, 2021
f325312
refine order
jackalcooper Jun 18, 2021
5adff19
refine order
jackalcooper Jun 18, 2021
75dc746
refine order
jackalcooper Jun 18, 2021
9cbb2d3
less deps
jackalcooper Jun 18, 2021
6afc5ad
refine
jackalcooper Jun 18, 2021
39e0072
rm mkl note
jackalcooper Jun 18, 2021
6b492f1
refine
jackalcooper Jun 18, 2021
b0d230e
refine
jackalcooper Jun 18, 2021
4dfb4ff
Merge branch 'support_ninja' of https://github.com/Oneflow-Inc/oneflo…
jackalcooper Jun 18, 2021
cdacff8
Merge branch 'support_ninja' of https://github.com/Oneflow-Inc/oneflo…
jackalcooper Jun 18, 2021
e436059
Merge branch 'master' of https://github.com/Oneflow-Inc/oneflow into …
jackalcooper Jun 18, 2021
cba5170
Merge branch 'support_ninja' of https://github.com/Oneflow-Inc/oneflo…
jackalcooper Jun 18, 2021
f73115e
Merge branch 'master' of https://github.com/Oneflow-Inc/oneflow into …
jackalcooper Jun 18, 2021
33a80c9
link py libs if building shared lib on mac
jackalcooper Jun 18, 2021
9a5da67
Merge branch 'master' of https://github.com/Oneflow-Inc/oneflow into …
jackalcooper Jun 18, 2021
6ea9072
Merge branch 'master' of https://github.com/Oneflow-Inc/oneflow into …
jackalcooper Jun 21, 2021
ec3c43e
refine
jackalcooper Jun 23, 2021
2be0974
Merge branch 'master' of https://github.com/Oneflow-Inc/oneflow into …
jackalcooper Jun 23, 2021
4d306b0
Merge branch 'master' into fix_macos_support
jackalcooper Jun 23, 2021
9f9c6c7
Merge branch 'master' of https://github.com/Oneflow-Inc/oneflow into …
jackalcooper Jun 24, 2021
818ff16
add handy name
jackalcooper Jun 24, 2021
3d89cdc
refine
jackalcooper Jun 24, 2021
9bfd2ac
refine
jackalcooper Jun 24, 2021
806e07b
Merge branch 'master' of https://github.com/Oneflow-Inc/oneflow into …
jackalcooper Jun 24, 2021
7cddeb8
Merge branch 'master' of https://github.com/Oneflow-Inc/oneflow into …
jackalcooper Jun 24, 2021
ea2418d
refine
jackalcooper Jun 24, 2021
209c849
Merge branch 'master' into fix_macos_support
oneflow-ci-bot Jun 24, 2021
51a11d5
Merge branch 'master' into fix_macos_support
oneflow-ci-bot Jun 24, 2021
f9dd016
Merge branch 'master' into fix_macos_support
oneflow-ci-bot Jun 24, 2021
d290497
Merge branch 'fix_macos_support' of https://github.com/Oneflow-Inc/on…
jackalcooper Jun 24, 2021
ac5a5d4
Merge branch 'master' into fix_macos_support
oneflow-ci-bot Jun 24, 2021
4ceb380
refine
jackalcooper Jun 24, 2021
1e61dba
Merge branch 'master' into fix_macos_support
oneflow-ci-bot Jun 24, 2021
1570b94
refine
jackalcooper Jun 24, 2021
6868cb2
Merge branches 'fix_macos_support' and 'fix_macos_support' of https:/…
jackalcooper Jun 24, 2021
f98573f
refine
jackalcooper Jun 24, 2021
9597922
Merge branch 'master' into fix_macos_support
oneflow-ci-bot Jun 24, 2021
0791076
Merge branch 'master' into fix_macos_support
oneflow-ci-bot Jun 24, 2021
460d004
Merge branch 'master' into fix_macos_support
oneflow-ci-bot Jun 24, 2021
3b26ceb
Merge branch 'master' into fix_macos_support
oneflow-ci-bot Jun 25, 2021
14882ab
Merge branch 'master' into fix_macos_support
oneflow-ci-bot Jun 25, 2021
712922e
quick fix
jackalcooper Jun 25, 2021
494899b
Merge branch 'master' into fix_macos_support
oneflow-ci-bot Jun 25, 2021
be7c8d5
Merge branch 'master' into fix_macos_support
oneflow-ci-bot Jun 25, 2021
ab2b48c
refine
jackalcooper Jun 25, 2021
fe945be
Merge branch 'master' into fix_macos_support
oneflow-ci-bot Jun 25, 2021
c95f862
Merge branch 'fix_macos_support' of https://github.com/Oneflow-Inc/on…
jackalcooper Jun 25, 2021
8c6affb
refine
jackalcooper Jun 25, 2021
a97c2ac
refine
jackalcooper Jun 25, 2021
0c614d9
refine
jackalcooper Jun 25, 2021
4f7e179
Merge branch 'master' into fix_macos_support
oneflow-ci-bot Jun 25, 2021
fda19d1
Merge branch 'master' into fix_macos_support
oneflow-ci-bot Jun 25, 2021
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
22 changes: 15 additions & 7 deletions .github/workflows/simple.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ jobs:
echo "cmake_flags=${cmake_flags}" >> $GITHUB_ENV
shell: bash
- name: Build (third party)
if: startsWith(runner.os, 'Linux')
run: |
set -x
mkdir -p build-third_party
Expand All @@ -91,46 +90,55 @@ jobs:
cmake --build . -j $(nproc)
shell: bash
- name: Build (of_ccobj)
if: startsWith(runner.os, 'Linux')
run: |
mkdir -p build
cd build
cmake .. ${{ env.cmake_flags }} -DTHIRD_PARTY=OFF -DONEFLOW=ON -DTHIRD_PARTY_DIR=$PWD/../third_party_install
cmake --build . -j ${{ matrix.make_concurrency }} --target of_ccobj
shell: bash
- name: Build (oneflow_internal)
if: startsWith(runner.os, 'Linux')
if: always()
run: |
mkdir -p build
cd build
cmake .. ${{ env.cmake_flags }} -DTHIRD_PARTY=OFF -DONEFLOW=ON
cmake --build . -j ${{ matrix.make_concurrency }} --target oneflow_internal
shell: bash
- name: Build (oneflow_py)
if: startsWith(runner.os, 'Linux')
if: always()
run: |
mkdir -p build
cd build
cmake .. ${{ env.cmake_flags }} -DTHIRD_PARTY=OFF -DONEFLOW=ON
cmake --build . -j ${{ matrix.make_concurrency }} --target oneflow_py
shell: bash
- name: Build (oneflow_testexe)
if: always()
run: |
mkdir -p build
cd build
cmake .. ${{ env.cmake_flags }} -DTHIRD_PARTY=OFF -DONEFLOW=ON
cmake --build . -j ${{ matrix.make_concurrency }} --target oneflow_testexe
shell: bash
- name: Build (ALL)
if: startsWith(runner.os, 'Linux')
if: always()
run: |
mkdir -p build
cd build
cmake .. ${{ env.cmake_flags }} -DTHIRD_PARTY=OFF -DONEFLOW=ON
cmake --build . -j ${{ matrix.make_concurrency }}
shell: bash
- name: Exe test
if: startsWith(runner.os, 'Linux')
if: always()
continue-on-error: true
run: |
mkdir -p build
cd build
./bin/oneflow_testexe
shell: bash
- name: Op test
if: startsWith(runner.os, 'Linux')
if: always()
continue-on-error: true
run: |
source build/source.sh
ONEFLOW_TEST_GITHUB_HOSTED=1 ONEFLOW_TEST_CPU_ONLY=1 bash ci/test/1node_op_test.sh
Expand Down
12 changes: 11 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,20 @@ option(BUILD_CUDA "" ON)
option(BUILD_TESTING "" OFF)
option(WITH_XLA "Option to build with XLA" OFF)
option(WITH_TENSORRT "Option to build with TensorRT" OFF)
option(WITH_COCOAPI "Option to build with COCO API" ON)
option(BUILD_GIT_VERSION "" ON)
option(BUILD_PROFILER "" OFF)
option(OF_SOFTMAX_USE_FAST_MATH "" ON)
set(RPC_BACKEND "GRPC,LOCAL" CACHE STRING "")
set(THIRD_PARTY_MIRROR "" CACHE STRING "")
set(PIP_INDEX_MIRROR "" CACHE STRING "")

if (APPLE)
set(RPC_BACKEND "LOCAL")
set(BUILD_CUDA OFF)
set(WITH_COCOAPI OFF)
endif()

if (CMAKE_BUILD_TYPE MATCHES Debug)
set(CUDNN_STATIC OFF CACHE BOOL "")
else ()
Expand Down Expand Up @@ -68,6 +75,9 @@ endif()
if (WITH_TENSORRT)
add_definitions(-DWITH_TENSORRT)
endif()
if (WITH_COCOAPI)
add_definitions(-DWITH_COCOAPI)
endif()
if (USE_CXX11_ABI)
add_definitions(-D_GLIBCXX_USE_CXX11_ABI=1)
else()
Expand Down Expand Up @@ -178,7 +188,7 @@ if (THIRD_PARTY)
else()
add_custom_target(prepare_oneflow_third_party ALL)
endif()

add_custom_target(oneflow_deps ALL DEPENDS prepare_oneflow_third_party)
# skip oneflow cmake to avoid errors caused by the absences of python-dev, proto src
if (ONEFLOW)
include(oneflow)
Expand Down
14 changes: 9 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,15 @@
- For more useful flags, plese run the script with flag `--help` or refer to the source code of the script.

- #### Option 3: Build on bare metal
- Install dependencies. For instance, on Ubuntu 20.04, run:
```
sudo apt install -y libmkl-full-dev nasm libc++-11-dev libncurses5 g++ gcc cmake gdb python3-pip
```
If there is a prompt, it is recommended to select the option to make mkl the default BLAS library.
- Install dependencies
- on Ubuntu 20.04, run:
```
sudo apt install -y libopenblas-dev nasm g++ gcc python3-pip cmake
```
- on macOS, run:
```
brew install nasm
```
- In the root directory of OneFlow source code, run:

```
Expand Down
2 changes: 1 addition & 1 deletion ci/test/1node_op_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ for CHUNK in 1
do
export ONEFLOW_TEST_DEVICE_NUM=${CHUNK}
python3 $src_dir/ci/test/parallel_run.py \
--gpu_num=${gpu_num} \
--gpu_num="${gpu_num}" \
--dir=test/ops \
--timeout=1 \
--verbose \
Expand Down
8 changes: 5 additions & 3 deletions ci/test/doctest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@
set -xe
export PYTHONUNBUFFERED=1
src_dir=${ONEFLOW_SRC_DIR:-"$PWD"}
test_tmp_dir=${ONEFLOW_TEST_TMP_DIR:-"./test_tmp_dir"}

cd `python3 -c "import oneflow; print(oneflow.__path__[0])"`
cd ..
mkdir -p ${test_tmp_dir}
cd ${test_tmp_dir}
python3 -c 'import oneflow; f=open("oneflow_path.txt", "w"); f.write(oneflow.__path__[0])'

gpu_num=$(nvidia-smi --query-gpu=name --format=csv,noheader | wc -l)
python3 $src_dir/ci/test/parallel_run.py \
--gpu_num=${gpu_num} \
--dir=${PWD} \
--dir=$(cat oneflow_path.txt) \
--timeout=1 \
--verbose \
--chunk=1 \
Expand Down
6 changes: 3 additions & 3 deletions cmake/oneflow.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -251,16 +251,16 @@ if (USE_CLANG_FORMAT)
endif()

if (BUILD_SHARED_LIBS)
get_filename_component(GLOG_RPATH "${GLOG_STATIC_LIBRARIES}" DIRECTORY)
get_filename_component(PB_RPATH "${PROTOBUF_LIBRARY_DIR}" DIRECTORY)
target_link_libraries(of_ccobj of_protoobj of_cfgobj ${ONEFLOW_CUDA_LIBS} glog_imported)
set_target_properties(of_ccobj PROPERTIES INSTALL_RPATH "${GLOG_RPATH} ${PB_RPATH}")
endif()

# py ext lib
add_library(of_pyext_obj ${of_pyext_obj_cc})
target_include_directories(of_pyext_obj PRIVATE ${Python_INCLUDE_DIRS} ${Python_NumPy_INCLUDE_DIRS})
target_link_libraries(of_pyext_obj of_ccobj)
if(BUILD_SHARED_LIBS AND APPLE)
target_link_libraries(of_pyext_obj ${Python3_LIBRARIES})
endif()
add_dependencies(of_pyext_obj of_ccobj)

if(APPLE)
Expand Down
11 changes: 8 additions & 3 deletions cmake/third_party.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ include(glog)
include(libjpeg-turbo)
include(opencv)
include(eigen)
include(cocoapi)
if (WITH_COCOAPI)
include(cocoapi)
endif()
include(half)
include(re2)
include(json)
Expand Down Expand Up @@ -158,8 +160,6 @@ set(oneflow_third_party_dependencies
libpng_copy_headers_to_destination
opencv_copy_libs_to_destination
eigen
cocoapi_copy_headers_to_destination
cocoapi_copy_libs_to_destination
half_copy_headers_to_destination
re2
json_copy_headers_to_destination
Expand All @@ -168,6 +168,11 @@ set(oneflow_third_party_dependencies
lz4_copy_headers_to_destination
)

if (WITH_COCOAPI)
list(APPEND oneflow_third_party_dependencies cocoapi_copy_headers_to_destination)
list(APPEND oneflow_third_party_dependencies cocoapi_copy_libs_to_destination)
endif()

if (RPC_BACKEND MATCHES "GRPC")
list(APPEND oneflow_third_party_dependencies grpc)
endif()
Expand Down
5 changes: 1 addition & 4 deletions cmake/third_party/opencv.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@ else()
set(OPENCV_BUILD_3RDPARTY_LIBRARY_DIR ${OPENCV_INSTALL_DIR}/share/OpenCV/3rdparty/${CMAKE_INSTALL_LIBDIR})
set(OPENCV_LIBRARY_NAMES libopencv_imgproc.a libopencv_imgcodecs.a libopencv_core.a)
set(OPENCV_3RDPARTY_LIBRARY_NAMES libIlmImf.a liblibjasper.a liblibpng.a liblibtiff.a liblibwebp.a)
if (NOT APPLE)
set(OPENCV_3RDPARTY_LIBRARY_NAMES ${OPENCV_3RDPARTY_LIBRARY_NAMES} libittnotify.a)
endif()
endif()

foreach(LIBRARY_NAME ${OPENCV_LIBRARY_NAMES})
Expand Down Expand Up @@ -110,7 +107,7 @@ ExternalProject_Add(opencv
-DBUILD_OPENEXR:BOOL=ON
-DBUILD_TBB:BOOL=ON
-DBUILD_IPP_IW:BOOL=OFF
-DWITH_ITT:BOOL=ON
-DWITH_ITT:BOOL=OFF
-DBUILD_opencv_flann:BOOL=OFF
-DBUILD_opencv_ml:BOOL=OFF
-DBUILD_opencv_objdetect:BOOL=OFF
Expand Down
3 changes: 2 additions & 1 deletion dev-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ wheel
tqdm
requests
jinja2
opencv-python==4.2.0.34; sys_platform != 'darwin'
opencv-python; python_version >= "3.9" and sys_platform != 'darwin'
opencv-python==4.2.0.34; python_version < '3.9' and sys_platform != 'darwin'
PyYAML
4 changes: 4 additions & 0 deletions oneflow/core/eager/transport_blob_instruction_type.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#ifdef __linux__

#include "oneflow/core/eager/transport_blob_instruction_type.h"
#include "oneflow/core/vm/instruction_operand.msg.h"
#include "oneflow/core/vm/object_wrapper.h"
Expand Down Expand Up @@ -179,3 +181,5 @@ COMMAND(vm::RegisterInstructionType<ReceiveBlobInstructionType>("ReceiveBlob"));

} // namespace vm
} // namespace oneflow

#endif // __linux__
4 changes: 4 additions & 0 deletions oneflow/core/eager/transport_blob_instruction_type.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#ifdef __linux__

#ifndef ONEFLOW_CORE_EAGER_SEND_BLOB_INSTRUCTION_TYPE_H_
#define ONEFLOW_CORE_EAGER_SEND_BLOB_INSTRUCTION_TYPE_H_

Expand Down Expand Up @@ -69,3 +71,5 @@ class ReceiveBlobInstructionType : public vm::InstructionType {
} // namespace oneflow

#endif // ONEFLOW_CORE_EAGER_SEND_BLOB_INSTRUCTION_TYPE_H_

#endif // __linux__
4 changes: 4 additions & 0 deletions oneflow/core/eager/transport_blob_instruction_type_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ struct ReceiveRequest {
HashMap<uint64_t, SendRequest> token2send_request;
HashMap<uint64_t, ReceiveRequest> token2recv_request;

#ifdef __linux__
class TestSendBlobInstructionType : public SendBlobInstructionType {
public:
TestSendBlobInstructionType() = default;
Expand Down Expand Up @@ -125,6 +126,7 @@ class TestReceiveBlobInstructionType : public ReceiveBlobInstructionType {
}
};
COMMAND(vm::RegisterInstructionType<TestReceiveBlobInstructionType>("TestReceiveBlob"));
#endif // __linux__

using InstructionMsgList = OBJECT_MSG_LIST(vm::InstructionMsg, instr_msg_link);

Expand Down Expand Up @@ -258,6 +260,7 @@ void DestroyNumProcessPerNode() { Global<NumProcessPerNode>::Delete(); }

} // namespace

#ifdef __linux__
TEST(SendReceiveInstructionType, naive) {
InitNumProcessPerNode();
#ifdef WITH_CUDA
Expand Down Expand Up @@ -306,6 +309,7 @@ TEST(SendReceiveInstructionType, naive) {
ASSERT_TRUE(token2recv_request.find(body_token) != token2recv_request.end());
DestroyNumProcessPerNode();
}
#endif // __linux__

} // namespace test
} // namespace vm
Expand Down
4 changes: 4 additions & 0 deletions oneflow/core/job/env_global_objects_scope.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,16 +143,20 @@ Maybe<void> EnvGlobalObjectsScope::Init(const EnvProto& env_proto) {
Global<vm::VirtualMachineScope>::New(Global<ResourceDesc, ForSession>::Get()->resource());
Global<EagerJobBuildAndInferCtxMgr>::New();
if (!Global<ResourceDesc, ForSession>::Get()->enable_dry_run()) {
#ifdef __linux__
Global<EpollCommNet>::New();
Global<Transport>::New();
#endif // __linux__
}
return Maybe<void>::Ok();
}

EnvGlobalObjectsScope::~EnvGlobalObjectsScope() {
if (!Global<ResourceDesc, ForSession>::Get()->enable_dry_run()) {
#ifdef __linux__
Global<Transport>::Delete();
Global<EpollCommNet>::Delete();
#endif // __linux__
}
Global<EagerJobBuildAndInferCtxMgr>::Delete();
Global<vm::VirtualMachineScope>::Delete();
Expand Down
3 changes: 2 additions & 1 deletion oneflow/core/ndarray/cpu_concat_var_ndarray.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ class CpuConcatVarNdarray : public CpuNdarray<T, NDIMS> {
size_t var_contiguous_size = 0;
var_ndarray(var_index).GetMutPtrAndContiguousSize(var_offset, ptr, &var_contiguous_size);
*size = std::min(var_contiguous_size,
contiguous_lens_[var_index] - var_offset % contiguous_lens_[var_index]);
static_cast<size_t>(contiguous_lens_[var_index]
- var_offset % contiguous_lens_[var_index]));
}

private:
Expand Down
2 changes: 2 additions & 0 deletions oneflow/core/platform/include/wrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ class DynamicLibrary {

static std::unique_ptr<DynamicLibrary> Load(const std::vector<std::string>& names);
void* LoadSym(const char* name);
#ifdef __linux__
std::string AbsolutePath();
#endif // __linux__

private:
DynamicLibrary(void* handle) : handle_(handle){};
Expand Down
9 changes: 8 additions & 1 deletion oneflow/core/platform/lib/wrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ limitations under the License.
*/
#include "oneflow/core/platform/include/wrapper.h"
#include <dlfcn.h>

#ifdef __linux__
#include <link.h>
#endif // __linux__

namespace oneflow {
namespace platform {
Expand All @@ -41,7 +44,9 @@ std::unique_ptr<DynamicLibrary> DynamicLibrary::Load(const std::vector<std::stri
void* handle = dlopen(name.c_str(), RTLD_LOCAL | RTLD_NOW);
if (handle != nullptr) {
DynamicLibrary* lib = new DynamicLibrary(handle);
std::cerr << "loaded library: " << lib->AbsolutePath() << "\n";
#ifdef __linux__
std::cout << "loaded library: " << lib->AbsolutePath() << "\n";
#endif // __linux__
return std::unique_ptr<DynamicLibrary>(lib);
}
}
Expand All @@ -50,11 +55,13 @@ std::unique_ptr<DynamicLibrary> DynamicLibrary::Load(const std::vector<std::stri

void* DynamicLibrary::LoadSym(const char* name) { return OpenSymbol(handle_, name); }

#ifdef __linux__
std::string DynamicLibrary::AbsolutePath() {
struct link_map* map;
dlinfo(handle_, RTLD_DI_LINKMAP, &map);
return map->l_name;
}
#endif // __linux__

DynamicLibrary::~DynamicLibrary() { dlclose(handle_); }

Expand Down
4 changes: 4 additions & 0 deletions oneflow/core/transport/transport.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#ifdef __linux__

#ifndef ONEFLOW_CORE_TRANSPORT_TRANSPORT_H_
#define ONEFLOW_CORE_TRANSPORT_TRANSPORT_H_

Expand Down Expand Up @@ -137,3 +139,5 @@ class Transport {
} // namespace oneflow

#endif // ONEFLOW_CORE_TRANSPORT_TRANSPORT_H_

#endif // __linux__
Loading