diff options
| -rw-r--r-- | guix-science/packages/machine-learning.scm | 183 | ||||
| -rw-r--r-- | patches/python-ray.patch | 106 |
2 files changed, 126 insertions, 163 deletions
diff --git a/guix-science/packages/machine-learning.scm b/guix-science/packages/machine-learning.scm index e1f6497..82c6628 100644 --- a/guix-science/packages/machine-learning.scm +++ b/guix-science/packages/machine-learning.scm | |||
| @@ -1107,7 +1107,9 @@ protocol is supported.") | |||
| 1107 | (file-name (git-file-name name version)) | 1107 | (file-name (git-file-name name version)) |
| 1108 | (sha256 | 1108 | (sha256 |
| 1109 | (base32 | 1109 | (base32 |
| 1110 | "0v8l43wyvdh5papcgkx4wksgmddav4pz83cdd45nrlwlm4h3j8gb")))) | 1110 | "0v8l43wyvdh5papcgkx4wksgmddav4pz83cdd45nrlwlm4h3j8gb")) |
| 1111 | (patches | ||
| 1112 | (search-patches "patches/python-ray.patch")))) | ||
| 1111 | (build-system bazel-build-system) | 1113 | (build-system bazel-build-system) |
| 1112 | (arguments | 1114 | (arguments |
| 1113 | (list | 1115 | (list |
| @@ -1134,87 +1136,15 @@ protocol is supported.") | |||
| 1134 | "toolchain_type = \"@bazel_tools//tools/python:autodetecting_toolchain\",") | 1136 | "toolchain_type = \"@bazel_tools//tools/python:autodetecting_toolchain\",") |
| 1135 | (("srcs = \\[\"@jemalloc//:shared\"\\],") "srcs = [],")) | 1137 | (("srcs = \\[\"@jemalloc//:shared\"\\],") "srcs = [],")) |
| 1136 | (substitute* "WORKSPACE" | 1138 | (substitute* "WORKSPACE" |
| 1137 | (("load\\(\"@rules_python//python:repositories.bzl\", \"python_register_toolchains\"\\)" m) | 1139 | (("@GUIX_OPENSSL@") |
| 1138 | (string-append m " | 1140 | #$(this-package-input "openssl")) |
| 1139 | load(\"@rules_python//python:repositories.bzl\", \"py_repositories\")")) | 1141 | (("@GUIX_JEMALLOC@") |
| 1140 | ;; Use our own Python toolchain | 1142 | #$(this-package-input "jemalloc")) |
| 1141 | (("register_toolchains\\(\"//:python_toolchain\"\\)") | 1143 | (("@GUIX_REDIS@") |
| 1142 | "register_toolchains(\"@bazel_tools//tools/python:autodetecting_toolchain\")") | 1144 | #$(this-package-input "redis")) |
| 1143 | ;; Do not specify bundled 3.9 toolchain. | 1145 | (("@GUIX_HIREDIS@") |
| 1144 | (("load\\(\"@python3_9.*") "") | 1146 | #$(this-package-input "hiredis"))) |
| 1145 | (("python_interpreter_target = python39,") "") | ||
| 1146 | ;; Do not rebuild old versions of openssl... | ||
| 1147 | (("load\\(\"//bazel:ray_deps_setup.bzl" m) | ||
| 1148 | (string-append | ||
| 1149 | "\ | ||
| 1150 | new_local_repository( | ||
| 1151 | name = \"openssl\", | ||
| 1152 | path = \"" #$(this-package-input "openssl") "\", | ||
| 1153 | build_file_content = \"\"\" | ||
| 1154 | cc_library( | ||
| 1155 | name = \"openssl\", | ||
| 1156 | includes = [\"include\"], | ||
| 1157 | linkopts = [\"-lssl\", \"-lcrypto\"], | ||
| 1158 | visibility = [\"//visibility:public\"], | ||
| 1159 | ) | ||
| 1160 | \"\"\", | ||
| 1161 | ) | ||
| 1162 | " | ||
| 1163 | ;; ...and jemalloc... | ||
| 1164 | "\ | ||
| 1165 | new_local_repository( | ||
| 1166 | name = \"jemalloc\", | ||
| 1167 | path = \"" #$(this-package-input "jemalloc") "\", | ||
| 1168 | build_file_content = \"\"\" | ||
| 1169 | cc_library( | ||
| 1170 | name = \"libjemalloc\", | ||
| 1171 | includes = [\"include\"], | ||
| 1172 | linkopts = [\"-ljemalloc\", \"-ldl\"], | ||
| 1173 | visibility = [\"//visibility:public\"], | ||
| 1174 | ) | ||
| 1175 | filegroup( | ||
| 1176 | name = \"shared\", | ||
| 1177 | srcs = [], | ||
| 1178 | visibility = [\"//visibility:public\"], | ||
| 1179 | ) | ||
| 1180 | \"\"\", | ||
| 1181 | ) | ||
| 1182 | " | ||
| 1183 | 1147 | ||
| 1184 | ;; ...and redis... | ||
| 1185 | "\ | ||
| 1186 | new_local_repository( | ||
| 1187 | name = \"com_github_antirez_redis\", | ||
| 1188 | path = \"" #$(this-package-input "redis") "\", | ||
| 1189 | build_file_content = \"\"\" | ||
| 1190 | filegroup( | ||
| 1191 | name = \"redis-server\", | ||
| 1192 | srcs = [\"bin/redis-server\"], | ||
| 1193 | visibility = [\"//visibility:public\"], | ||
| 1194 | ) | ||
| 1195 | filegroup( | ||
| 1196 | name = \"redis-cli\", | ||
| 1197 | srcs = [\"bin/redis-cli\"], | ||
| 1198 | visibility = [\"//visibility:public\"], | ||
| 1199 | ) | ||
| 1200 | \"\"\", | ||
| 1201 | ) | ||
| 1202 | " | ||
| 1203 | ;; ...and hiredis | ||
| 1204 | "\ | ||
| 1205 | new_local_repository( | ||
| 1206 | name = \"com_github_redis_hiredis\", | ||
| 1207 | path = \"" #$(this-package-input "hiredis") "\", | ||
| 1208 | build_file_content = \"\"\" | ||
| 1209 | cc_library( | ||
| 1210 | name = \"hiredis\", | ||
| 1211 | includes = [\"include\"], | ||
| 1212 | linkopts = [\"-lhiredis\", \"-lhiredis_ssl\"], | ||
| 1213 | visibility = [\"//visibility:public\"], | ||
| 1214 | ) | ||
| 1215 | \"\"\", | ||
| 1216 | ) | ||
| 1217 | " m))) | ||
| 1218 | (substitute* "bazel/ray_deps_build_all.bzl" | 1148 | (substitute* "bazel/ray_deps_build_all.bzl" |
| 1219 | ((" rules_foreign_cc_dependencies\\(\\).*") "\ | 1149 | ((" rules_foreign_cc_dependencies\\(\\).*") "\ |
| 1220 | rules_foreign_cc_dependencies( | 1150 | rules_foreign_cc_dependencies( |
| @@ -1248,7 +1178,7 @@ cc_library( | |||
| 1248 | #$(this-package-input "python-wrapper") | 1178 | #$(this-package-input "python-wrapper") |
| 1249 | "/bin/python")) | 1179 | "/bin/python")) |
| 1250 | #:vendored-inputs-hash | 1180 | #:vendored-inputs-hash |
| 1251 | "18psd9pd8wyc5dz93hfr8ai9yw8nfs5dayg1aq3cs5hgjpywh2kf" | 1181 | "0kr0nrhlclxcak3w8rk95sxggd0krh8si89b14k7g64d6i6prxfk" |
| 1252 | #:phases | 1182 | #:phases |
| 1253 | #~(modify-phases (@ (guix-science build bazel-build-system) %standard-phases) | 1183 | #~(modify-phases (@ (guix-science build bazel-build-system) %standard-phases) |
| 1254 | (add-after 'unpack 'patch-python-build-system | 1184 | (add-after 'unpack 'patch-python-build-system |
| @@ -1259,87 +1189,14 @@ cc_library( | |||
| 1259 | "toolchain_type = \"@bazel_tools//tools/python:autodetecting_toolchain\",") | 1189 | "toolchain_type = \"@bazel_tools//tools/python:autodetecting_toolchain\",") |
| 1260 | (("srcs = \\[\"@jemalloc//:shared\"\\],") "srcs = [],")) | 1190 | (("srcs = \\[\"@jemalloc//:shared\"\\],") "srcs = [],")) |
| 1261 | (substitute* "WORKSPACE" | 1191 | (substitute* "WORKSPACE" |
| 1262 | (("load\\(\"@rules_python//python:repositories.bzl\", \"python_register_toolchains\"\\)" m) | 1192 | (("@GUIX_OPENSSL@") |
| 1263 | (string-append m " | 1193 | #$(this-package-input "openssl")) |
| 1264 | load(\"@rules_python//python:repositories.bzl\", \"py_repositories\")")) | 1194 | (("@GUIX_JEMALLOC@") |
| 1265 | ;; Use our own Python toolchain | 1195 | #$(this-package-input "jemalloc")) |
| 1266 | (("register_toolchains\\(\"//:python_toolchain\"\\)") | 1196 | (("@GUIX_REDIS@") |
| 1267 | "register_toolchains(\"@bazel_tools//tools/python:autodetecting_toolchain\")") | 1197 | #$(this-package-input "redis")) |
| 1268 | ;; Do not specify bundled 3.9 toolchain. | 1198 | (("@GUIX_HIREDIS@") |
| 1269 | (("load\\(\"@python3_9.*") "") | 1199 | #$(this-package-input "hiredis"))) |
| 1270 | (("python_interpreter_target = python39,") "") | ||
| 1271 | ;; Do not rebuild old versions of openssl... | ||
| 1272 | (("load\\(\"//bazel:ray_deps_setup.bzl" m) | ||
| 1273 | (string-append | ||
| 1274 | "\ | ||
| 1275 | new_local_repository( | ||
| 1276 | name = \"openssl\", | ||
| 1277 | path = \"" #$(this-package-input "openssl") "\", | ||
| 1278 | build_file_content = \"\"\" | ||
| 1279 | cc_library( | ||
| 1280 | name = \"openssl\", | ||
| 1281 | includes = [\"include\"], | ||
| 1282 | linkopts = [\"-lssl\", \"-lcrypto\"], | ||
| 1283 | visibility = [\"//visibility:public\"], | ||
| 1284 | ) | ||
| 1285 | \"\"\", | ||
| 1286 | ) | ||
| 1287 | " | ||
| 1288 | ;; ...and jemalloc... | ||
| 1289 | "\ | ||
| 1290 | new_local_repository( | ||
| 1291 | name = \"jemalloc\", | ||
| 1292 | path = \"" #$(this-package-input "jemalloc") "\", | ||
| 1293 | build_file_content = \"\"\" | ||
| 1294 | cc_library( | ||
| 1295 | name = \"libjemalloc\", | ||
| 1296 | includes = [\"include\"], | ||
| 1297 | linkopts = [\"-ljemalloc\", \"-ldl\"], | ||
| 1298 | visibility = [\"//visibility:public\"], | ||
| 1299 | ) | ||
| 1300 | filegroup( | ||
| 1301 | name = \"shared\", | ||
| 1302 | srcs = [], | ||
| 1303 | visibility = [\"//visibility:public\"], | ||
| 1304 | ) | ||
| 1305 | \"\"\", | ||
| 1306 | ) | ||
| 1307 | " | ||
| 1308 | |||
| 1309 | ;; ...and redis... | ||
| 1310 | "\ | ||
| 1311 | new_local_repository( | ||
| 1312 | name = \"com_github_antirez_redis\", | ||
| 1313 | path = \"" #$(this-package-input "redis") "\", | ||
| 1314 | build_file_content = \"\"\" | ||
| 1315 | filegroup( | ||
| 1316 | name = \"redis-server\", | ||
| 1317 | srcs = [\"bin/redis-server\"], | ||
| 1318 | visibility = [\"//visibility:public\"], | ||
| 1319 | ) | ||
| 1320 | filegroup( | ||
| 1321 | name = \"redis-cli\", | ||
| 1322 | srcs = [\"bin/redis-cli\"], | ||
| 1323 | visibility = [\"//visibility:public\"], | ||
| 1324 | ) | ||
| 1325 | \"\"\", | ||
| 1326 | ) | ||
| 1327 | " | ||
| 1328 | ;; ...and hiredis | ||
| 1329 | "\ | ||
| 1330 | new_local_repository( | ||
| 1331 | name = \"com_github_redis_hiredis\", | ||
| 1332 | path = \"" #$(this-package-input "hiredis") "\", | ||
| 1333 | build_file_content = \"\"\" | ||
| 1334 | cc_library( | ||
| 1335 | name = \"hiredis\", | ||
| 1336 | includes = [\"include\"], | ||
| 1337 | linkopts = [\"-lhiredis\", \"-lhiredis_ssl\"], | ||
| 1338 | visibility = [\"//visibility:public\"], | ||
| 1339 | ) | ||
| 1340 | \"\"\", | ||
| 1341 | ) | ||
| 1342 | " m))) | ||
| 1343 | (substitute* "bazel/ray_deps_build_all.bzl" | 1200 | (substitute* "bazel/ray_deps_build_all.bzl" |
| 1344 | ((" rules_foreign_cc_dependencies\\(\\).*") "\ | 1201 | ((" rules_foreign_cc_dependencies\\(\\).*") "\ |
| 1345 | rules_foreign_cc_dependencies( | 1202 | rules_foreign_cc_dependencies( |
diff --git a/patches/python-ray.patch b/patches/python-ray.patch new file mode 100644 index 0000000..c66226b --- /dev/null +++ b/patches/python-ray.patch | |||
| @@ -0,0 +1,106 @@ | |||
| 1 | --- a/WORKSPACE | ||
| 2 | +++ b/WORKSPACE | ||
| 3 | @@ -10,6 +10,69 @@ | ||
| 4 | ], | ||
| 5 | ) | ||
| 6 | |||
| 7 | +new_local_repository( | ||
| 8 | + name = "openssl", | ||
| 9 | + path = "@GUIX_OPENSSL@", | ||
| 10 | + build_file_content = """ | ||
| 11 | +cc_library( | ||
| 12 | + name = "openssl", | ||
| 13 | + includes = ["include"], | ||
| 14 | + linkopts = ["-lssl", "-lcrypto"], | ||
| 15 | + visibility = ["//visibility:public"], | ||
| 16 | +) | ||
| 17 | +""", | ||
| 18 | +) | ||
| 19 | +new_local_repository( | ||
| 20 | + name = "jemalloc", | ||
| 21 | + path = "@GUIX_JEMALLOC@", | ||
| 22 | + build_file_content = """ | ||
| 23 | +cc_library( | ||
| 24 | + name = "libjemalloc", | ||
| 25 | + includes = ["include"], | ||
| 26 | + linkopts = ["-ljemalloc", "-ldl"], | ||
| 27 | + visibility = ["//visibility:public"], | ||
| 28 | +) | ||
| 29 | +filegroup( | ||
| 30 | + name = "shared", | ||
| 31 | + srcs = [], | ||
| 32 | + visibility = ["//visibility:public"], | ||
| 33 | +) | ||
| 34 | +""", | ||
| 35 | +) | ||
| 36 | + | ||
| 37 | +new_local_repository( | ||
| 38 | + name = "com_github_antirez_redis", | ||
| 39 | + path = "@GUIX_REDIS@", | ||
| 40 | + build_file_content = """ | ||
| 41 | +filegroup( | ||
| 42 | + name = "redis-server", | ||
| 43 | + srcs = ["bin/redis-server"], | ||
| 44 | + visibility = ["//visibility:public"], | ||
| 45 | +) | ||
| 46 | +filegroup( | ||
| 47 | + name = "redis-cli", | ||
| 48 | + srcs = ["bin/redis-cli"], | ||
| 49 | + visibility = ["//visibility:public"], | ||
| 50 | +) | ||
| 51 | +""", | ||
| 52 | +) | ||
| 53 | +new_local_repository( | ||
| 54 | + name = "com_github_redis_hiredis", | ||
| 55 | + path = "@GUIX_HIREDIS@", | ||
| 56 | + build_file_content = """ | ||
| 57 | +cc_library( | ||
| 58 | + name = "hiredis", | ||
| 59 | + includes = ["include"], | ||
| 60 | + linkopts = ["-lhiredis", "-lhiredis_ssl"], | ||
| 61 | + visibility = ["//visibility:public"], | ||
| 62 | +) | ||
| 63 | +""", | ||
| 64 | +) | ||
| 65 | + | ||
| 66 | + | ||
| 67 | + | ||
| 68 | + | ||
| 69 | + | ||
| 70 | load("//bazel:ray_deps_setup.bzl", "ray_deps_setup") | ||
| 71 | |||
| 72 | ray_deps_setup() | ||
| 73 | @@ -47,6 +110,7 @@ | ||
| 74 | ) | ||
| 75 | |||
| 76 | load("@rules_python//python:repositories.bzl", "python_register_toolchains") | ||
| 77 | +load("@rules_python//python:repositories.bzl", "py_repositories") | ||
| 78 | |||
| 79 | python_register_toolchains( | ||
| 80 | name = "python3_9", | ||
| 81 | @@ -54,24 +118,7 @@ | ||
| 82 | register_toolchains = False, | ||
| 83 | ) | ||
| 84 | |||
| 85 | -load("@python3_9//:defs.bzl", python39 = "interpreter") | ||
| 86 | -load("@rules_python//python/pip_install:repositories.bzl", "pip_install_dependencies") | ||
| 87 | - | ||
| 88 | -pip_install_dependencies() | ||
| 89 | - | ||
| 90 | -load("@rules_python//python:pip.bzl", "pip_parse") | ||
| 91 | - | ||
| 92 | -pip_parse( | ||
| 93 | - name = "py_deps_buildkite", | ||
| 94 | - python_interpreter_target = python39, | ||
| 95 | - requirements_lock = "//release:requirements_buildkite.txt", | ||
| 96 | -) | ||
| 97 | - | ||
| 98 | -load("@py_deps_buildkite//:requirements.bzl", install_py_deps_buildkite = "install_deps") | ||
| 99 | - | ||
| 100 | -install_py_deps_buildkite() | ||
| 101 | - | ||
| 102 | -register_toolchains("//:python_toolchain") | ||
| 103 | +register_toolchains("@bazel_tools//tools/python:autodetecting_toolchain") | ||
| 104 | |||
| 105 | register_execution_platforms( | ||
| 106 | "@local_config_platform//:host", | ||
