mirror of
https://github.com/ml-explore/mlx.git
synced 2025-09-18 10:26:56 +08:00
Fix a few ccache cache miss (#2573)
* Fix ccache cache miss * Do not define _VERSION_ in python bindings
This commit is contained in:
@@ -1,10 +1,8 @@
|
|||||||
// Copyright © 2025 Apple Inc.
|
// Copyright © 2025 Apple Inc.
|
||||||
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
namespace mlx::core {
|
namespace mlx::core {
|
||||||
|
|
||||||
std::string version() {
|
const char* version() {
|
||||||
return MLX_VERSION;
|
return MLX_VERSION;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -15,6 +15,6 @@ namespace mlx::core {
|
|||||||
*
|
*
|
||||||
* For dev builds, the version will include the suffix ".devYYYYMMDD+hash"
|
* For dev builds, the version will include the suffix ".devYYYYMMDD+hash"
|
||||||
*/
|
*/
|
||||||
std::string version();
|
const char* version();
|
||||||
|
|
||||||
} // namespace mlx::core
|
} // namespace mlx::core
|
||||||
|
@@ -52,7 +52,6 @@ set_target_properties(
|
|||||||
${MLX_PYTHON_BINDINGS_OUTPUT_DIRECTORY})
|
${MLX_PYTHON_BINDINGS_OUTPUT_DIRECTORY})
|
||||||
|
|
||||||
target_link_libraries(core PRIVATE mlx)
|
target_link_libraries(core PRIVATE mlx)
|
||||||
target_compile_definitions(core PRIVATE _VERSION_=${MLX_VERSION})
|
|
||||||
|
|
||||||
if(BUILD_SHARED_LIBS)
|
if(BUILD_SHARED_LIBS)
|
||||||
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
||||||
|
@@ -2,9 +2,9 @@
|
|||||||
|
|
||||||
#include <nanobind/nanobind.h>
|
#include <nanobind/nanobind.h>
|
||||||
|
|
||||||
#define STRINGIFY(x) #x
|
#include "mlx/version.h"
|
||||||
#define TOSTRING(x) STRINGIFY(x)
|
|
||||||
|
|
||||||
|
namespace mx = mlx::core;
|
||||||
namespace nb = nanobind;
|
namespace nb = nanobind;
|
||||||
|
|
||||||
void init_mlx_func(nb::module_&);
|
void init_mlx_func(nb::module_&);
|
||||||
@@ -48,5 +48,5 @@ NB_MODULE(core, m) {
|
|||||||
init_distributed(m);
|
init_distributed(m);
|
||||||
init_export(m);
|
init_export(m);
|
||||||
|
|
||||||
m.attr("__version__") = TOSTRING(_VERSION_);
|
m.attr("__version__") = mx::version();
|
||||||
}
|
}
|
||||||
|
3
setup.py
3
setup.py
@@ -121,7 +121,8 @@ class CMakeBuild(build_ext):
|
|||||||
build_args += [f"-j{os.cpu_count()}"]
|
build_args += [f"-j{os.cpu_count()}"]
|
||||||
|
|
||||||
# Avoid cache miss when building from temporary dirs.
|
# Avoid cache miss when building from temporary dirs.
|
||||||
os.environ["CCACHE_BASEDIR"] = os.path.abspath(self.build_temp)
|
os.environ["CCACHE_BASEDIR"] = os.path.realpath(self.build_temp)
|
||||||
|
os.environ["CCACHE_NOHASHDIR"] = "true"
|
||||||
|
|
||||||
subprocess.run(
|
subprocess.run(
|
||||||
["cmake", ext.sourcedir, *cmake_args], cwd=build_temp, check=True
|
["cmake", ext.sourcedir, *cmake_args], cwd=build_temp, check=True
|
||||||
|
Reference in New Issue
Block a user