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

BUG: Fix import error on Mac #66

Merged
merged 9 commits into from
Aug 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions .github/workflows/build-wheel.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ jobs:
CIBW_BUILD_VERBOSITY: 1
with:
package-dir: ./python/


- uses: actions/upload-artifact@v3
with:
Expand Down
20 changes: 18 additions & 2 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,23 @@ add_subdirectory(collective/rendezvous)
add_subdirectory(collective/gloo)

pybind11_add_module(xoscar_pygloo collective/gloo/main.cc)

target_link_libraries(xoscar_pygloo PRIVATE GlooLib gloo StoreLib fmt::fmt)
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
include(FindPkgConfig)
pkg_search_module(libuv REQUIRED libuv>=1.26)
find_file(
libuv_LIBRARY
NAMES libuv.a libuv_a.a
PATHS ${libuv_LIBDIR}
NO_DEFAULT_PATH)
if(NOT EXISTS ${libuv_LIBRARY})
message(FATAL_ERROR "Unable to find static libuv library in " ${libuv_LIBDIR})
endif()
add_library(uv_s INTERFACE IMPORTED)
set_target_properties(uv_s PROPERTIES INTERFACE_INCLUDE_DIRECTORIES ${libuv_INCLUDE_DIRS}
INTERFACE_LINK_LIBRARIES ${libuv_LIBRARY})
target_link_libraries(xoscar_pygloo PRIVATE GlooLib gloo StoreLib fmt::fmt uv_s)
else()
target_link_libraries(xoscar_pygloo PRIVATE GlooLib gloo StoreLib fmt::fmt)
endif()
set_target_properties(xoscar_pygloo PROPERTIES LIBRARY_OUTPUT_DIRECTORY
${LIBRARY_OUTPUT_DIRECTORY})
2 changes: 1 addition & 1 deletion python/xoscar/collective/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

import numpy as np

from ..tests.core import lazy_import
from ..utils import lazy_import
from . import xoscar_pygloo as xp

ReduceOpMappingGloo: Dict["CollectiveReduceOp", "xp.ReduceOp"] = {}
Expand Down
2 changes: 1 addition & 1 deletion python/xoscar/collective/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

from .. import Actor, actor_ref
from ..context import get_context
from ..tests.core import lazy_import
from ..utils import lazy_import
from .common import (
COLLECTIVE_DEVICE_ID_ENV_KEY,
INVOKE_ERROR_MESSAGE,
Expand Down
3 changes: 1 addition & 2 deletions python/xoscar/collective/process_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@
from abc import ABC, abstractmethod
from typing import Any, List, Optional

from ..tests.core import lazy_import
from ..utils import is_linux
from ..utils import is_linux, lazy_import
from . import xoscar_pygloo as xp
from .common import (
RENDEZVOUS_MASTER_IP_ENV_KEY,
Expand Down
2 changes: 1 addition & 1 deletion python/xoscar/collective/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

import numpy as np

from ..tests.core import lazy_import
from ..utils import lazy_import

cupy = lazy_import("cupy")

Expand Down