Metal Support
Metal is a low-level 3D graphics and compute API created by Apple for Apple platforms
Metal support is enabled by default on macOS on Apple Silicon Macs, and is disabled by default on Intel Macs.
The pre-built binaries of node-llama-cpp for macOS are built with Metal support enabled for Apple Silicon Macs, and when building from source on macOS on Apple Silicon Macs, Metal support is enabled by default.
llama.cpp doesn't support Metal well on Intel Macs, so it is disabled by default on those machines.
Accelerate framework is always enabled on Mac.
Toggling Metal Support
Prerequisites
cmake-jsdependencies- CMake 3.26 or higher (optional, recommended if you have build issues)
Building node-llama-cpp With Metal Support Disabled
Run this command inside of your project:
npx --no node-llama-cpp source download --gpu falseIf
cmakeis not installed on your machine,node-llama-cppwill automatically downloadcmaketo an internal directory and try to use it to buildllama.cppfrom source.
Building node-llama-cpp With Metal Support Enabled
Run this command inside of your project:
npx --no node-llama-cpp source download --gpu metalIf
cmakeis not installed on your machine,node-llama-cppwill automatically downloadcmaketo an internal directory and try to use it to buildllama.cppfrom source.
