LeelaChessZero / lc0

The rewritten engine, originally for tensorflow. Now all other backends have been ported here.
GNU General Public License v3.0
2.37k stars 523 forks source link

How to compile LC0 METAL backend on Linux Ubuntu 23.10, when using a MacBook Pro M1 MAX and Parallels Desktop? #1944

Closed Chess321 closed 5 months ago

Chess321 commented 7 months ago

I've downloaded multihead-arch-metal https://github.com/LeelaChessZero/lc0/pull/1916 https://github.com/almaudoh/lc0/tree/multihead-arch-metal

parallels@ubuntu-linux-22-04-02-desktop:~$ cd /home/parallels/lc0 parallels@ubuntu-linux-22-04-02-desktop:~/lc0$ ./build.sh

The Meson build system Version: 1.2.1 Source dir: /home/parallels/lc0 Build dir: /home/parallels/lc0/build/release Build type: native build Project name: lc0 Project version: undefined C++ compiler for the host machine: c++ (gcc 13.2.0 "c++ (Ubuntu 13.2.0-4ubuntu3) 13.2.0") C++ linker for the host machine: c++ ld.bfd 2.41 Host machine cpu family: aarch64 Host machine cpu: aarch64 Has header "optional" : YES Has header "string_view" : YES Has header "charconv" : YES Compiler for C++ supports arguments -march=native: YES Compiler for C++ supports arguments -mfpu=neon: NO Compiler for C++ supports arguments -mfpu=neon: NO (cached) Program scripts/compile_proto.py found: YES (/home/parallels/lc0/scripts/compile_proto.py) Program git found: YES (/usr/bin/git) WARNING: You should add the boolean check kwarg to the run_command call. It currently defaults to false, but it will default to true in future releases of meson. See also: https://github.com/mesonbuild/meson/issues/9300 Message: updating git submodule libs/lczero-common Message: Using build identifier "git.c285401". Configuring build_id.h using configuration Run-time dependency threads found: YES Library dl found: YES Found pkg-config: /usr/bin/pkg-config (1.8.1) Did not find CMake 'cmake' Found CMake: NO Run-time dependency tensorflow_cc found: NO (tried pkgconfig and cmake) Run-time dependency accelerate found: NO (tried pkgconfig and cmake) Library mkl_rt found: NO Library mklml found: NO Library dnnl found: NO Library openblas.dll found: NO Library openblas found: NO Run-time dependency eigen3 found: NO (tried pkgconfig and cmake) Looking for a fallback subproject for the dependency eigen3 Downloading eigen source from https://gitlab.com/libeigen/eigen/-/archive/3.4.0/eigen-3.4.0.tar.bz2 Downloading file of unknown size. Downloading eigen patch from https://wrapdb.mesonbuild.com/v2/eigen_3.4.0-1/get_patch Download size: 5619 Downloading: ..........

Executing subproject eigen

eigen| Project name: eigen eigen| Project version: 3.4.0 eigen| C++ compiler for the host machine: c++ (gcc 13.2.0 "c++ (Ubuntu 13.2.0-4ubuntu3) 13.2.0") eigen| C++ linker for the host machine: c++ ld.bfd 2.41 eigen| Build targets in project: 0 eigen| Subproject eigen finished.

Dependency eigen3 from subproject subprojects/eigen-3.4.0 found: YES 3.4.0 Program ispc found: NO Library OpenCL found: NO Run-time dependency opencl found: NO Library cublas found: NO Library cudnn found: NO Library cudart found: NO Program nvcc /usr/local/cuda/bin/nvcc /opt/cuda/bin/nvcc found: NO Run-time dependency appleframeworks found: NO (tried framework) Run-time dependency zlib found: YES 1.2.13 WARNING: find_library('libatomic') starting in "lib" only works by accident and is not portable Library libatomic found: YES Run-time dependency GTest found: NO (tried pkgconfig and system) Looking for a fallback subproject for the dependency gtest Downloading gtest source from https://github.com/google/googletest/archive/release-1.10.0.zip Downloading file of unknown size. Downloading gtest patch from https://wrapdb.mesonbuild.com/v1/projects/gtest/1.10.0/1/get_zip Download size: 2093 Downloading: ..........

Executing subproject gtest

gtest| Project name: gtest gtest| Project version: 1.10.0 gtest| C++ compiler for the host machine: c++ (gcc 13.2.0 "c++ (Ubuntu 13.2.0-4ubuntu3) 13.2.0") gtest| C++ linker for the host machine: c++ ld.bfd 2.41 gtest| Dependency threads found: YES unknown (cached) gtest| Dependency threads found: YES unknown (cached) gtest| Dependency threads found: YES unknown (cached) gtest| Dependency threads found: YES unknown (cached) gtest| Build targets in project: 1 gtest| Subproject gtest finished.

Dependency gtest from subproject subprojects/googletest-release-1.10.0 found: YES 1.10.0 Build targets in project: 8

lc0 undefined

Subprojects eigen : YES gtest : YES

User defined options buildtype: release prefix : /usr/local

Found ninja-1.11.1 at /usr/bin/ninja WARNING: Running the setup command as meson [options] instead of meson setup [options] is ambiguous and deprecated. INFO: autodetecting backend as ninja INFO: calculating backend command to run: /usr/bin/ninja -C /home/parallels/lc0/build/release ninja: Entering directory `/home/parallels/lc0/build/release' [7/160] Compiling C++ object lc0.p/src_utils_protomessage.cc.o ../../src/utils/protomessage.cc: In function ‘std::string lczero::{anonymous}::EscapeJsonString(const std::string&)’: ../../src/utils/protomessage.cc:140:11: warning: comparison is always true due to limited range of data type [-Wtype-limits] 140 | if (c >= 0 && c <= ' ') { | ^~ [69/160] Compiling C++ object liblc0_lib.so.p/src_utils_protomessage.cc.o ../../src/utils/protomessage.cc: In function ‘std::string lczero::{anonymous}::EscapeJsonString(const std::string&)’: ../../src/utils/protomessage.cc:140:11: warning: comparison is always true due to limited range of data type [-Wtype-limits] 140 | if (c >= 0 && c <= ' ') { | ^~ [145/160] Compiling C++ object encoder_test.p/src_utils_protomessage.cc.o ../../src/utils/protomessage.cc: In function ‘std::string lczero::{anonymous}::EscapeJsonString(const std::string&)’: ../../src/utils/protomessage.cc:140:11: warning: comparison is always true due to limited range of data type [-Wtype-limits] 140 | if (c >= 0 && c <= ' ') { | ^~ [160/160] Linking target hashcat_test

——————————————————————————————————————————————————————————————————

parallels@ubuntu-linux-22-04-02-desktop:~/lc0/build/release$ ./lc0 | | | | | |_| v0.31.0-dev+git.c285401 built Jan 15 2024 go nodes 100 Creating backend [eigen]... error The eigen backend requires a network file. go nodes 100 Found pb network file: ./BT4-1024x15x32h-swa-3400000.pb Creating backend [eigen]... error Network format NetworkStructure(134) is not supported by BLAS backend.

mooskagh commented 5 months ago

There's no way to cross-compile a Mac version of Lc0 on Linux.