mirror of
https://github.com/ml-explore/mlx.git
synced 2025-06-24 09:21:16 +08:00
MinGW support (#1806)
* Changed /bin/bash to bash for generating compiling preamble * Fix wrt jit_compiler mingw like msvc wrt. WEXITSTATUS * Solved ambiguity wrt. bernoulli test shape * Disabled distributed/ring on Windows * Fixed jit_compiler command wrt. MinGW * Extended jit_compiler patch wrt. WEXITSTATUS to FreeBSD
This commit is contained in:
parent
80c863b972
commit
2d8e667400
@ -22,7 +22,7 @@ if(MSVC)
|
||||
set(SHELL_CMD powershell -ExecutionPolicy Bypass -File)
|
||||
else()
|
||||
set(SHELL_EXT sh)
|
||||
set(SHELL_CMD /bin/bash)
|
||||
set(SHELL_CMD bash)
|
||||
endif()
|
||||
|
||||
add_custom_command(
|
||||
|
@ -96,7 +96,7 @@ std::string JitCompiler::build_command(
|
||||
libpaths);
|
||||
#else
|
||||
return fmt::format(
|
||||
"g++ -std=c++17 -O3 -Wall -fPIC -shared '{0}' -o '{1}' 2>&1",
|
||||
"g++ -std=c++17 -O3 -Wall -fPIC -shared \"{0}\" -o \"{1}\" 2>&1",
|
||||
(dir / source_file_name).string(),
|
||||
(dir / shared_lib_name).string());
|
||||
#endif
|
||||
@ -133,7 +133,7 @@ std::string JitCompiler::exec(const std::string& cmd) {
|
||||
if (status == -1) {
|
||||
throw std::runtime_error("pclose() failed.");
|
||||
}
|
||||
#ifdef _MSC_VER
|
||||
#if defined(_WIN32) || defined(__FreeBSD__)
|
||||
int code = status;
|
||||
#else
|
||||
int code = WEXITSTATUS(status);
|
||||
|
@ -12,7 +12,7 @@ function(make_jit_source SRC_FILE)
|
||||
add_custom_command(
|
||||
OUTPUT jit/${SRC_NAME}.cpp
|
||||
COMMAND
|
||||
/bin/bash ${CMAKE_CURRENT_SOURCE_DIR}/make_compiled_preamble.sh
|
||||
bash ${CMAKE_CURRENT_SOURCE_DIR}/make_compiled_preamble.sh
|
||||
${CMAKE_CURRENT_BINARY_DIR}/jit ${CMAKE_C_COMPILER} ${PROJECT_SOURCE_DIR}
|
||||
${SRC_FILE}
|
||||
DEPENDS make_compiled_preamble.sh kernels/${SRC_FILE}.h ${ARGN})
|
||||
|
@ -1,4 +1,4 @@
|
||||
if(MLX_BUILD_CPU)
|
||||
if(MLX_BUILD_CPU AND NOT WIN32)
|
||||
target_sources(mlx PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/ring.cpp)
|
||||
else()
|
||||
target_sources(mlx PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/no_ring.cpp)
|
||||
|
@ -556,7 +556,7 @@ TEST_CASE("test random bernoulli") {
|
||||
|
||||
p = array({0.1, 0.2, 0.3});
|
||||
// Ask for the wrong shape => throws
|
||||
CHECK_THROWS_AS(random::bernoulli(p, {2}), std::invalid_argument);
|
||||
CHECK_THROWS_AS(random::bernoulli(p, Shape({2})), std::invalid_argument);
|
||||
|
||||
// Check wrong key type or shape
|
||||
auto key = array({0, 0}, {1, 2});
|
||||
|
Loading…
Reference in New Issue
Block a user