mirror of
https://github.com/ml-explore/mlx.git
synced 2025-06-24 09:21:16 +08:00

* export and import functions * refactor + works for few primitives * nit * allow primitives with state * nit * nit * simplify serialize / deserialize * fix for constants * python bindings * maybe fix serialize failure case * add example * more primitives, training kind of works * same result for python and c++ * some fixes * fix export * template it up * some simplificatoin * rebase * allow kwargs and multiple functions * exporter * more primitives for exporting * deal with endianness * handle invalid stream * add docstring
28 lines
795 B
CMake
28 lines
795 B
CMake
cmake_minimum_required(VERSION 3.27)
|
|
|
|
project(import_mlx LANGUAGES CXX)
|
|
|
|
# ----------------------------- Setup -----------------------------
|
|
set(CMAKE_CXX_STANDARD 17)
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
|
|
|
# ----------------------------- Dependencies -----------------------------
|
|
find_package(
|
|
Python 3.9
|
|
COMPONENTS Interpreter Development.Module
|
|
REQUIRED)
|
|
execute_process(
|
|
COMMAND "${Python_EXECUTABLE}" -m pip show mlx
|
|
COMMAND grep location
|
|
COMMAND awk "{print $4 \"/mlx\"}"
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
|
OUTPUT_VARIABLE MLX_ROOT)
|
|
find_package(MLX CONFIG REQUIRED)
|
|
|
|
add_executable(eval_mlp eval_mlp.cpp)
|
|
target_link_libraries(eval_mlp PRIVATE mlx)
|
|
|
|
add_executable(train_mlp train_mlp.cpp)
|
|
target_link_libraries(train_mlp PRIVATE mlx)
|