mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-10-30 16:10:36 +00:00
python3Packages.tensorflow: drop (#571207)
This commit is contained in:
@@ -92,6 +92,8 @@
|
||||
|
||||
- `jmtpfs` has been removed due to lack of maintenance and fuse3 support.
|
||||
|
||||
- `python3Packages.tensorflow-build` and `libtensorflow` have been removed, as they had been broken for years. Use `python3Packages.tensorflow` (`tensorflow-bin`) instead. The `withTensorflow` options of `ffmpeg` and `snips-sh` have been removed accordingly.
|
||||
|
||||
- `postgresqlPackages.anonymizer` has been updated from 2.4.1 to 3.2.2. The extension must be dropped and recreated, and masking no longer runs as a superuser. See the [upgrade notes](https://postgresql-anonymizer.readthedocs.io/en/stable/UPGRADE/) for details. `pg-dump-anon` has been removed as it was removed upstream. Use `pg_dump` with a masked role instead.
|
||||
|
||||
- `landrun` was updated to `0.1.17`, which included breaking changes, reference the [breaking changes](https://github.com/Zouuup/landrun/releases/tag/v0.1.17) section in the `landrun` release notes.
|
||||
|
||||
@@ -29,9 +29,7 @@ in
|
||||
options.services.snips-sh = {
|
||||
enable = mkEnableOption "snips.sh";
|
||||
|
||||
package = mkPackageOption pkgs "snips-sh" {
|
||||
example = "pkgs.snips-sh.override {withTensorflow = true;}";
|
||||
};
|
||||
package = mkPackageOption pkgs "snips-sh" { };
|
||||
|
||||
stateDir = mkOption {
|
||||
type = types.path;
|
||||
|
||||
@@ -3,8 +3,6 @@
|
||||
buildGoModule,
|
||||
fetchFromGitHub,
|
||||
sqlite,
|
||||
libtensorflow,
|
||||
withTensorflow ? false,
|
||||
nixosTests,
|
||||
}:
|
||||
buildGoModule (finalAttrs: {
|
||||
@@ -19,9 +17,9 @@ buildGoModule (finalAttrs: {
|
||||
hash = "sha256-71YEkCUZqX/Hyq8wzj5Lf+ydDO708F+44ILLKrTpHF0=";
|
||||
};
|
||||
|
||||
tags = (lib.optional (!withTensorflow) "noguesser");
|
||||
tags = [ "noguesser" ];
|
||||
|
||||
buildInputs = [ sqlite ] ++ (lib.optional withTensorflow libtensorflow);
|
||||
buildInputs = [ sqlite ];
|
||||
|
||||
passthru.tests = nixosTests.snips-sh;
|
||||
|
||||
|
||||
@@ -149,7 +149,6 @@
|
||||
withSsh ? withHeadlessDeps, # SFTP protocol
|
||||
withSvg ? withFullDeps, # SVG protocol
|
||||
withSvtav1 ? withHeadlessDeps && !stdenv.hostPlatform.isMinGW, # AV1 encoder/decoder (focused on speed and correctness)
|
||||
withTensorflow ? false, # Tensorflow dnn backend support (Increases closure size by ~390 MiB)
|
||||
withTheora ? withHeadlessDeps, # Theora encoder
|
||||
withTwolame ? withFullDeps, # MP2 encoding
|
||||
withUavs3d ? withFullDeps, # AVS3 decoder
|
||||
@@ -310,7 +309,6 @@
|
||||
librist,
|
||||
librsvg,
|
||||
libssh,
|
||||
libtensorflow,
|
||||
libtheora,
|
||||
libv4l,
|
||||
libva,
|
||||
@@ -742,7 +740,7 @@ stdenv.mkDerivation (
|
||||
(enableFeature withSsh "libssh")
|
||||
(enableFeature withSvg "librsvg")
|
||||
(enableFeature withSvtav1 "libsvtav1")
|
||||
(enableFeature withTensorflow "libtensorflow")
|
||||
(enableFeature false "libtensorflow")
|
||||
(enableFeature withTheora "libtheora")
|
||||
(enableFeature withTwolame "libtwolame")
|
||||
(enableFeature withUavs3d "libuavs3d")
|
||||
@@ -965,7 +963,6 @@ stdenv.mkDerivation (
|
||||
++ optionals withSsh [ libssh ]
|
||||
++ optionals withSvg [ librsvg ]
|
||||
++ optionals withSvtav1 [ svt-av1 ]
|
||||
++ optionals withTensorflow [ libtensorflow ]
|
||||
++ optionals withTheora [ libtheora ]
|
||||
++ optionals withTwolame [ twolame ]
|
||||
++ optionals withUavs3d [ uavs3d ]
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
diff -Naurd x/third_party/systemlibs/absl_py.absl.flags.BUILD y/third_party/systemlibs/absl_py.absl.flags.BUILD
|
||||
--- x/third_party/systemlibs/absl_py.absl.flags.BUILD 2023-09-20 06:02:15.079683729 +0000
|
||||
+++ y/third_party/systemlibs/absl_py.absl.flags.BUILD 2023-09-20 06:04:58.491897303 +0000
|
||||
@@ -5,3 +5,7 @@
|
||||
py_library(
|
||||
name = "flags",
|
||||
)
|
||||
+
|
||||
+py_library(
|
||||
+ name = "argparse_flags",
|
||||
+)
|
||||
@@ -1,389 +0,0 @@
|
||||
diff -Naurd x/tensorflow/c/experimental/stream_executor/stream_executor.cc y/tensorflow/c/experimental/stream_executor/stream_executor.cc
|
||||
--- x/tensorflow/c/experimental/stream_executor/stream_executor.cc 2023-10-19 14:25:48.648646416 +0000
|
||||
+++ y/tensorflow/c/experimental/stream_executor/stream_executor.cc 2023-10-19 14:29:11.700743574 +0000
|
||||
@@ -23,6 +23,7 @@
|
||||
|
||||
#include <string>
|
||||
#include <utility>
|
||||
+#include <optional>
|
||||
|
||||
#include "absl/functional/any_invocable.h"
|
||||
#include "tensorflow/c/c_api_macros.h"
|
||||
@@ -275,17 +276,17 @@
|
||||
stream_executor_->unified_memory_deallocate(&device_, mem);
|
||||
}
|
||||
|
||||
- absl::optional<AllocatorStats> GetAllocatorStats() override {
|
||||
+ std::optional<AllocatorStats> GetAllocatorStats() override {
|
||||
SP_AllocatorStats c_stats{SP_ALLOCATORSTATS_STRUCT_SIZE};
|
||||
TF_Bool has_stats =
|
||||
stream_executor_->get_allocator_stats(&device_, &c_stats);
|
||||
if (!has_stats) {
|
||||
- return absl::nullopt;
|
||||
+ return std::nullopt;
|
||||
}
|
||||
tsl::Status status = ValidateSPAllocatorStats(c_stats);
|
||||
if (!status.ok()) {
|
||||
LOG(ERROR) << status.message();
|
||||
- return absl::nullopt;
|
||||
+ return std::nullopt;
|
||||
}
|
||||
::stream_executor::AllocatorStats stats;
|
||||
stats.num_allocs = c_stats.num_allocs;
|
||||
diff -Naurd x/tensorflow/c/experimental/stream_executor/stream_executor_test.cc y/tensorflow/c/experimental/stream_executor/stream_executor_test.cc
|
||||
--- x/tensorflow/c/experimental/stream_executor/stream_executor_test.cc 2023-10-19 14:25:48.648646416 +0000
|
||||
+++ y/tensorflow/c/experimental/stream_executor/stream_executor_test.cc 2023-10-19 14:29:11.700743574 +0000
|
||||
@@ -15,6 +15,7 @@
|
||||
#include "tensorflow/c/experimental/stream_executor/stream_executor.h"
|
||||
|
||||
#include <utility>
|
||||
+#include <optional>
|
||||
|
||||
#include "tensorflow/c/experimental/stream_executor/stream_executor_internal.h"
|
||||
#include "tensorflow/c/experimental/stream_executor/stream_executor_test_util.h"
|
||||
@@ -239,7 +240,7 @@
|
||||
};
|
||||
|
||||
StreamExecutor* executor = GetExecutor(0);
|
||||
- absl::optional<AllocatorStats> optional_stats = executor->GetAllocatorStats();
|
||||
+ std::optional<AllocatorStats> optional_stats = executor->GetAllocatorStats();
|
||||
ASSERT_TRUE(optional_stats.has_value());
|
||||
AllocatorStats stats = optional_stats.value();
|
||||
ASSERT_EQ(stats.bytes_in_use, 123);
|
||||
diff -Naurd x/tensorflow/compiler/xla/stream_executor/allocator_stats.h y/tensorflow/compiler/xla/stream_executor/allocator_stats.h
|
||||
--- x/tensorflow/compiler/xla/stream_executor/allocator_stats.h 2023-10-19 14:25:55.064649379 +0000
|
||||
+++ y/tensorflow/compiler/xla/stream_executor/allocator_stats.h 2023-10-19 14:29:11.700743574 +0000
|
||||
@@ -17,6 +17,7 @@
|
||||
#define TENSORFLOW_COMPILER_XLA_STREAM_EXECUTOR_ALLOCATOR_STATS_H_
|
||||
|
||||
#include <string>
|
||||
+#include <optional>
|
||||
|
||||
#include "absl/types/optional.h"
|
||||
#include "tensorflow/compiler/xla/stream_executor/platform/port.h"
|
||||
diff -Naurd x/tensorflow/core/common_runtime/mkl_cpu_allocator.h y/tensorflow/core/common_runtime/mkl_cpu_allocator.h
|
||||
--- x/tensorflow/core/common_runtime/mkl_cpu_allocator.h 2023-10-19 14:25:58.996651199 +0000
|
||||
+++ y/tensorflow/core/common_runtime/mkl_cpu_allocator.h 2023-10-19 14:29:11.700743574 +0000
|
||||
@@ -22,6 +22,7 @@
|
||||
#ifdef INTEL_MKL
|
||||
|
||||
#include <cstdlib>
|
||||
+#include <optional>
|
||||
|
||||
#include "tensorflow/core/common_runtime/bfc_allocator.h"
|
||||
#include "tensorflow/core/common_runtime/pool_allocator.h"
|
||||
@@ -80,7 +81,7 @@
|
||||
port::AlignedFree(ptr);
|
||||
}
|
||||
|
||||
- absl::optional<AllocatorStats> GetStats() override {
|
||||
+ std::optional<AllocatorStats> GetStats() override {
|
||||
mutex_lock l(mutex_);
|
||||
return stats_;
|
||||
}
|
||||
@@ -242,7 +243,7 @@
|
||||
large_size_allocator_->DeallocateRaw(ptr);
|
||||
}
|
||||
}
|
||||
- absl::optional<AllocatorStats> GetStats() override {
|
||||
+ std::optional<AllocatorStats> GetStats() override {
|
||||
auto s_stats = small_size_allocator_->GetStats();
|
||||
auto l_stats = large_size_allocator_->GetStats();
|
||||
|
||||
diff -Naurd x/tensorflow/core/common_runtime/pluggable_device/pluggable_device_simple_allocator.cc y/tensorflow/core/common_runtime/pluggable_device/pluggable_device_simple_allocator.cc
|
||||
--- x/tensorflow/core/common_runtime/pluggable_device/pluggable_device_simple_allocator.cc 2023-10-19 14:25:59.236651310 +0000
|
||||
+++ y/tensorflow/core/common_runtime/pluggable_device/pluggable_device_simple_allocator.cc 2023-10-19 14:29:11.700743574 +0000
|
||||
@@ -32,7 +32,7 @@
|
||||
return sub_allocator_->Free(ptr, 0);
|
||||
}
|
||||
|
||||
-absl::optional<AllocatorStats> PluggableDeviceSimpleAllocator::GetStats() {
|
||||
+std::optional<AllocatorStats> PluggableDeviceSimpleAllocator::GetStats() {
|
||||
AllocatorStats stats_;
|
||||
stats_.num_allocs = 0;
|
||||
stats_.peak_bytes_in_use = 0;
|
||||
diff -Naurd x/tensorflow/core/common_runtime/pluggable_device/pluggable_device_simple_allocator.h y/tensorflow/core/common_runtime/pluggable_device/pluggable_device_simple_allocator.h
|
||||
--- x/tensorflow/core/common_runtime/pluggable_device/pluggable_device_simple_allocator.h 2023-10-19 14:25:59.236651310 +0000
|
||||
+++ y/tensorflow/core/common_runtime/pluggable_device/pluggable_device_simple_allocator.h 2023-10-19 14:29:11.700743574 +0000
|
||||
@@ -19,6 +19,7 @@
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
+#include <optional>
|
||||
|
||||
#include "tensorflow/core/common_runtime/device/device_mem_allocator.h"
|
||||
#include "tensorflow/core/platform/thread_annotations.h"
|
||||
@@ -37,7 +38,7 @@
|
||||
|
||||
bool TracksAllocationSizes() const override { return false; }
|
||||
string Name() override { return "Simple allocator"; }
|
||||
- absl::optional<AllocatorStats> GetStats() override;
|
||||
+ std::optional<AllocatorStats> GetStats() override;
|
||||
|
||||
AllocatorMemoryType GetMemoryType() const override {
|
||||
return sub_allocator_->GetMemoryType();
|
||||
diff -Naurd x/tensorflow/core/common_runtime/process_state.h y/tensorflow/core/common_runtime/process_state.h
|
||||
--- x/tensorflow/core/common_runtime/process_state.h 2023-10-19 14:25:59.076651236 +0000
|
||||
+++ y/tensorflow/core/common_runtime/process_state.h 2023-10-19 14:29:11.704743576 +0000
|
||||
@@ -20,6 +20,7 @@
|
||||
#include <map>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
+#include <optional>
|
||||
|
||||
#include "tensorflow/core/framework/allocator.h"
|
||||
#include "tensorflow/core/framework/allocator_registry.h"
|
||||
@@ -144,7 +145,7 @@
|
||||
size_t AllocatedSize(const void* p) const override {
|
||||
return a_->AllocatedSize(p);
|
||||
}
|
||||
- absl::optional<AllocatorStats> GetStats() override { return a_->GetStats(); }
|
||||
+ std::optional<AllocatorStats> GetStats() override { return a_->GetStats(); }
|
||||
bool ClearStats() override { return a_->ClearStats(); }
|
||||
|
||||
AllocatorMemoryType GetMemoryType() const override {
|
||||
diff -Naurd x/tensorflow/core/common_runtime/step_stats_collector.cc y/tensorflow/core/common_runtime/step_stats_collector.cc
|
||||
--- x/tensorflow/core/common_runtime/step_stats_collector.cc 2023-10-19 14:25:59.112651253 +0000
|
||||
+++ y/tensorflow/core/common_runtime/step_stats_collector.cc 2023-10-19 14:29:11.704743576 +0000
|
||||
@@ -15,6 +15,7 @@
|
||||
#include "tensorflow/core/common_runtime/step_stats_collector.h"
|
||||
|
||||
#include <memory>
|
||||
+#include <optional>
|
||||
|
||||
#include "tensorflow/core/common_runtime/costmodel_manager.h"
|
||||
#include "tensorflow/core/framework/allocation_description.pb.h"
|
||||
@@ -175,7 +176,7 @@
|
||||
memory->set_peak_bytes(std::get<1>(sizes));
|
||||
memory->set_live_bytes(std::get<2>(sizes));
|
||||
|
||||
- absl::optional<AllocatorStats> stats = allocator->GetStats();
|
||||
+ std::optional<AllocatorStats> stats = allocator->GetStats();
|
||||
if (stats) {
|
||||
memory->set_allocator_bytes_in_use(stats->bytes_in_use);
|
||||
}
|
||||
diff -Naurd x/tensorflow/core/framework/allocator_test.cc y/tensorflow/core/framework/allocator_test.cc
|
||||
--- x/tensorflow/core/framework/allocator_test.cc 2023-10-19 14:25:59.524651443 +0000
|
||||
+++ y/tensorflow/core/framework/allocator_test.cc 2023-10-19 14:29:11.704743576 +0000
|
||||
@@ -17,6 +17,7 @@
|
||||
|
||||
#include <algorithm>
|
||||
#include <vector>
|
||||
+#include <optional>
|
||||
|
||||
#include "tensorflow/core/framework/typed_allocator.h"
|
||||
#include "tensorflow/core/platform/logging.h"
|
||||
@@ -33,7 +34,7 @@
|
||||
|
||||
static void CheckStats(Allocator* a, int64_t num_allocs, int64_t bytes_in_use,
|
||||
int64_t peak_bytes_in_use, int64_t largest_alloc_size) {
|
||||
- absl::optional<AllocatorStats> stats = a->GetStats();
|
||||
+ std::optional<AllocatorStats> stats = a->GetStats();
|
||||
EXPECT_TRUE(stats);
|
||||
if (!stats) {
|
||||
return;
|
||||
@@ -255,7 +256,7 @@
|
||||
EXPECT_EQ(e0.Name(), "MemoryAllocation")
|
||||
<< "XSpace: " << xspace.DebugString();
|
||||
{
|
||||
- absl::optional<std::string> bytes_allocated, peak_bytes_in_use,
|
||||
+ std::optional<std::string> bytes_allocated, peak_bytes_in_use,
|
||||
requested_bytes, allocation_bytes;
|
||||
e0.ForEachStat([&](const ::tensorflow::profiler::XStatVisitor& stat) {
|
||||
LOG(ERROR) << "STAT " << stat.Name() << ": " << stat.ToString();
|
||||
@@ -282,7 +283,7 @@
|
||||
EXPECT_EQ(e1.Name(), "MemoryDeallocation")
|
||||
<< "XSpace: " << xspace.DebugString();
|
||||
{
|
||||
- absl::optional<std::string> bytes_allocated, peak_bytes_in_use,
|
||||
+ std::optional<std::string> bytes_allocated, peak_bytes_in_use,
|
||||
allocation_bytes;
|
||||
e1.ForEachStat([&](const ::tensorflow::profiler::XStatVisitor& stat) {
|
||||
if (stat.Name() == "bytes_allocated") {
|
||||
diff -Naurd x/tensorflow/core/framework/tracking_allocator_test.cc y/tensorflow/core/framework/tracking_allocator_test.cc
|
||||
--- x/tensorflow/core/framework/tracking_allocator_test.cc 2023-10-19 14:25:59.700651525 +0000
|
||||
+++ y/tensorflow/core/framework/tracking_allocator_test.cc 2023-10-19 14:29:11.704743576 +0000
|
||||
@@ -16,6 +16,7 @@
|
||||
#include "tensorflow/core/framework/tracking_allocator.h"
|
||||
|
||||
#include <unordered_map>
|
||||
+#include <optional>
|
||||
|
||||
#include "tensorflow/core/framework/allocator.h"
|
||||
#include "tensorflow/core/platform/logging.h"
|
||||
@@ -44,7 +45,7 @@
|
||||
EXPECT_NE(size_map_.end(), iter);
|
||||
return iter->second;
|
||||
}
|
||||
- absl::optional<AllocatorStats> GetStats() override { return absl::nullopt; }
|
||||
+ std::optional<AllocatorStats> GetStats() override { return std::nullopt; }
|
||||
|
||||
private:
|
||||
std::unordered_map<const void*, size_t> size_map_;
|
||||
@@ -58,7 +59,7 @@
|
||||
}
|
||||
void DeallocateRaw(void* ptr) override {}
|
||||
bool TracksAllocationSizes() const override { return true; }
|
||||
- absl::optional<AllocatorStats> GetStats() override { return absl::nullopt; }
|
||||
+ std::optional<AllocatorStats> GetStats() override { return std::nullopt; }
|
||||
};
|
||||
|
||||
TEST(TrackingAllocatorTest, SimpleNoTracking) {
|
||||
diff -Naurd x/tensorflow/core/grappler/clusters/single_machine.cc y/tensorflow/core/grappler/clusters/single_machine.cc
|
||||
--- x/tensorflow/core/grappler/clusters/single_machine.cc 2023-10-19 14:25:59.964651648 +0000
|
||||
+++ y/tensorflow/core/grappler/clusters/single_machine.cc 2023-10-19 14:29:11.704743576 +0000
|
||||
@@ -17,6 +17,7 @@
|
||||
|
||||
#include <atomic>
|
||||
#include <memory>
|
||||
+#include <optional>
|
||||
|
||||
#include "tensorflow/cc/training/queue_runner.h"
|
||||
#include "tensorflow/core/common_runtime/device.h"
|
||||
@@ -230,7 +231,7 @@
|
||||
return Status(absl::StatusCode::kInvalidArgument,
|
||||
"Tracking allocation is not enabled.");
|
||||
}
|
||||
- absl::optional<AllocatorStats> stats = allocator->GetStats();
|
||||
+ std::optional<AllocatorStats> stats = allocator->GetStats();
|
||||
(*device_peak_memory)[device->name()] =
|
||||
(stats ? stats->peak_bytes_in_use : 0);
|
||||
}
|
||||
diff -Naurd x/tensorflow/core/kernels/stack.cc y/tensorflow/core/kernels/stack.cc
|
||||
--- x/tensorflow/core/kernels/stack.cc 2023-10-19 14:26:01.668652437 +0000
|
||||
+++ y/tensorflow/core/kernels/stack.cc 2023-10-19 14:29:11.704743576 +0000
|
||||
@@ -18,6 +18,7 @@
|
||||
#include <limits.h>
|
||||
#include <atomic>
|
||||
#include <vector>
|
||||
+#include <optional>
|
||||
|
||||
#include "tensorflow/core/common_runtime/device.h"
|
||||
#include "tensorflow/core/framework/device_base.h"
|
||||
@@ -245,7 +246,7 @@
|
||||
DeviceContext* device_ctxt = ctx->op_device_context();
|
||||
auto device = static_cast<tensorflow::Device*>(ctx->device());
|
||||
Allocator* allocator = device->GetAllocator(alloc_attrs);
|
||||
- absl::optional<AllocatorStats> stats = allocator->GetStats();
|
||||
+ std::optional<AllocatorStats> stats = allocator->GetStats();
|
||||
if (stats && *stats->bytes_limit &&
|
||||
stats->bytes_in_use > (*stats->bytes_limit * kOccupancy)) {
|
||||
// Asynchronously copy the tensor from GPU to CPU memory.
|
||||
diff -Naurd x/tensorflow/python/tfe_wrapper.cc y/tensorflow/python/tfe_wrapper.cc
|
||||
--- x/tensorflow/python/tfe_wrapper.cc 2023-10-19 14:26:10.716656639 +0000
|
||||
+++ y/tensorflow/python/tfe_wrapper.cc 2023-10-19 14:29:11.708743578 +0000
|
||||
@@ -14,6 +14,7 @@
|
||||
==============================================================================*/
|
||||
|
||||
#include <memory>
|
||||
+#include <optional>
|
||||
|
||||
#include "Python.h"
|
||||
#include "absl/strings/match.h"
|
||||
@@ -691,7 +692,7 @@
|
||||
tensorflow::AllocatorAttributes attrs;
|
||||
tensorflow::Allocator* allocator = matched_device->GetAllocator(attrs);
|
||||
|
||||
- if (absl::optional<tensorflow::AllocatorStats> stats =
|
||||
+ if (std::optional<tensorflow::AllocatorStats> stats =
|
||||
allocator->GetStats()) {
|
||||
return std::map<std::string, int64_t>{{"current", stats->bytes_in_use},
|
||||
{"peak", stats->peak_bytes_in_use}};
|
||||
diff -Naurd x/tensorflow/tsl/framework/allocator.h y/tensorflow/tsl/framework/allocator.h
|
||||
--- x/tensorflow/tsl/framework/allocator.h 2023-10-19 14:26:15.884659044 +0000
|
||||
+++ y/tensorflow/tsl/framework/allocator.h 2023-10-19 14:29:11.708743578 +0000
|
||||
@@ -216,7 +216,7 @@
|
||||
}
|
||||
|
||||
// Fills in 'stats' with statistics collected by this allocator.
|
||||
- virtual absl::optional<AllocatorStats> GetStats() { return absl::nullopt; }
|
||||
+ virtual std::optional<AllocatorStats> GetStats() { return std::nullopt; }
|
||||
|
||||
// If implemented, clears the internal stats except for the `in_use` fields
|
||||
// and sets the `peak_bytes_in_use` to be equal to the `bytes_in_use`. Returns
|
||||
diff -Naurd x/tensorflow/tsl/framework/bfc_allocator.cc y/tensorflow/tsl/framework/bfc_allocator.cc
|
||||
--- x/tensorflow/tsl/framework/bfc_allocator.cc 2023-10-19 14:26:15.900659052 +0000
|
||||
+++ y/tensorflow/tsl/framework/bfc_allocator.cc 2023-10-19 14:29:11.708743578 +0000
|
||||
@@ -1205,7 +1205,7 @@
|
||||
return md;
|
||||
}
|
||||
|
||||
-absl::optional<AllocatorStats> BFCAllocator::GetStats() {
|
||||
+std::optional<AllocatorStats> BFCAllocator::GetStats() {
|
||||
mutex_lock l(lock_);
|
||||
return stats_;
|
||||
}
|
||||
diff -Naurd x/tensorflow/tsl/framework/bfc_allocator.h y/tensorflow/tsl/framework/bfc_allocator.h
|
||||
--- x/tensorflow/tsl/framework/bfc_allocator.h 2023-10-19 14:26:15.900659052 +0000
|
||||
+++ y/tensorflow/tsl/framework/bfc_allocator.h 2023-10-19 14:29:11.708743578 +0000
|
||||
@@ -22,6 +22,7 @@
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
+#include <optional>
|
||||
|
||||
#include "absl/container/flat_hash_set.h"
|
||||
#include "tensorflow/tsl/framework/allocator.h"
|
||||
@@ -93,7 +94,7 @@
|
||||
|
||||
int64_t AllocationId(const void* ptr) const override;
|
||||
|
||||
- absl::optional<AllocatorStats> GetStats() override;
|
||||
+ std::optional<AllocatorStats> GetStats() override;
|
||||
|
||||
bool ClearStats() override;
|
||||
|
||||
diff -Naurd x/tensorflow/tsl/framework/cpu_allocator_impl.cc y/tensorflow/tsl/framework/cpu_allocator_impl.cc
|
||||
--- x/tensorflow/tsl/framework/cpu_allocator_impl.cc 2023-10-19 14:26:15.928659065 +0000
|
||||
+++ y/tensorflow/tsl/framework/cpu_allocator_impl.cc 2023-10-19 14:29:11.708743578 +0000
|
||||
@@ -15,6 +15,7 @@
|
||||
|
||||
#include <algorithm>
|
||||
#include <atomic>
|
||||
+#include <optional>
|
||||
|
||||
#include "tensorflow/tsl/framework/allocator.h"
|
||||
#include "tensorflow/tsl/framework/allocator_registry.h"
|
||||
@@ -145,8 +146,8 @@
|
||||
/*level=*/tsl::profiler::TraceMeLevel::kInfo);
|
||||
}
|
||||
|
||||
- absl::optional<AllocatorStats> GetStats() override {
|
||||
- if (!cpu_allocator_collect_stats) return absl::nullopt;
|
||||
+ std::optional<AllocatorStats> GetStats() override {
|
||||
+ if (!cpu_allocator_collect_stats) return std::nullopt;
|
||||
mutex_lock l(mu_);
|
||||
return stats_;
|
||||
}
|
||||
diff -Naurd x/tensorflow/tsl/framework/tracking_allocator.cc y/tensorflow/tsl/framework/tracking_allocator.cc
|
||||
--- x/tensorflow/tsl/framework/tracking_allocator.cc 2023-10-19 14:26:15.968659084 +0000
|
||||
+++ y/tensorflow/tsl/framework/tracking_allocator.cc 2023-10-19 14:29:11.708743578 +0000
|
||||
@@ -152,7 +152,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
-absl::optional<AllocatorStats> TrackingAllocator::GetStats() {
|
||||
+std::optional<AllocatorStats> TrackingAllocator::GetStats() {
|
||||
return allocator_->GetStats();
|
||||
}
|
||||
|
||||
diff -Naurd x/tensorflow/tsl/framework/tracking_allocator.h y/tensorflow/tsl/framework/tracking_allocator.h
|
||||
--- x/tensorflow/tsl/framework/tracking_allocator.h 2023-10-19 14:26:15.968659084 +0000
|
||||
+++ y/tensorflow/tsl/framework/tracking_allocator.h 2023-10-19 14:29:11.712743580 +0000
|
||||
@@ -17,6 +17,7 @@
|
||||
#define TENSORFLOW_TSL_FRAMEWORK_TRACKING_ALLOCATOR_H_
|
||||
|
||||
#include <unordered_map>
|
||||
+#include <optional>
|
||||
|
||||
#include "tensorflow/tsl/framework/allocator.h"
|
||||
#include "tensorflow/tsl/lib/gtl/inlined_vector.h"
|
||||
@@ -66,7 +67,7 @@
|
||||
size_t RequestedSize(const void* ptr) const override;
|
||||
size_t AllocatedSize(const void* ptr) const override;
|
||||
int64_t AllocationId(const void* ptr) const override;
|
||||
- absl::optional<AllocatorStats> GetStats() override;
|
||||
+ std::optional<AllocatorStats> GetStats() override;
|
||||
bool ClearStats() override;
|
||||
|
||||
AllocatorMemoryType GetMemoryType() const override {
|
||||
@@ -1,166 +0,0 @@
|
||||
diff -Naurd x/third_party/absl/system.absl.base.BUILD y/third_party/absl/system.absl.base.BUILD
|
||||
--- x/third_party/absl/system.absl.base.BUILD 2023-09-17 09:12:05.499753364 +0000
|
||||
+++ y/third_party/absl/system.absl.base.BUILD 2023-09-17 09:16:01.200082822 +0000
|
||||
@@ -22,7 +22,12 @@
|
||||
|
||||
cc_library(
|
||||
name = "raw_logging_internal",
|
||||
- linkopts = ["-labsl_raw_logging_internal"],
|
||||
+ linkopts = [
|
||||
+ "-labsl_raw_logging_internal",
|
||||
+ "-labsl_log_internal_conditions",
|
||||
+ "-labsl_log_internal_message",
|
||||
+ "-labsl_log_internal_nullguard",
|
||||
+ ],
|
||||
visibility = [
|
||||
"//absl:__subpackages__",
|
||||
],
|
||||
diff -Naurd x/third_party/absl/system.absl.log.BUILD y/third_party/absl/system.absl.log.BUILD
|
||||
--- x/third_party/absl/system.absl.log.BUILD 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ y/third_party/absl/system.absl.log.BUILD 2023-09-17 09:12:11.795762177 +0000
|
||||
@@ -0,0 +1,134 @@
|
||||
+load("@rules_cc//cc:defs.bzl", "cc_library")
|
||||
+
|
||||
+package(default_visibility = ["//visibility:public"])
|
||||
+
|
||||
+cc_library(
|
||||
+ name = "absl_check",
|
||||
+ deps = [
|
||||
+ ],
|
||||
+)
|
||||
+
|
||||
+cc_library(
|
||||
+ name = "absl_log",
|
||||
+ deps = [
|
||||
+ ],
|
||||
+)
|
||||
+
|
||||
+cc_library(
|
||||
+ name = "check",
|
||||
+ deps = [
|
||||
+ ],
|
||||
+)
|
||||
+
|
||||
+cc_library(
|
||||
+ name = "die_if_null",
|
||||
+ deps = [
|
||||
+ ":log",
|
||||
+ "//absl/base:config",
|
||||
+ "//absl/base:core_headers",
|
||||
+ "//absl/strings",
|
||||
+ ],
|
||||
+)
|
||||
+
|
||||
+cc_library(
|
||||
+ name = "flags",
|
||||
+ deps = [
|
||||
+ ":globals",
|
||||
+ "//absl/base:config",
|
||||
+ "//absl/base:core_headers",
|
||||
+ "//absl/base:log_severity",
|
||||
+ "//absl/flags:flag",
|
||||
+ "//absl/flags:marshalling",
|
||||
+ "//absl/strings",
|
||||
+ ],
|
||||
+)
|
||||
+
|
||||
+cc_library(
|
||||
+ name = "globals",
|
||||
+ deps = [
|
||||
+ "//absl/base:atomic_hook",
|
||||
+ "//absl/base:config",
|
||||
+ "//absl/base:core_headers",
|
||||
+ "//absl/base:log_severity",
|
||||
+ "//absl/hash",
|
||||
+ "//absl/strings",
|
||||
+ ],
|
||||
+)
|
||||
+
|
||||
+cc_library(
|
||||
+ name = "initialize",
|
||||
+ deps = [
|
||||
+ ":globals",
|
||||
+ "//absl/base:config",
|
||||
+ "//absl/time",
|
||||
+ ],
|
||||
+)
|
||||
+
|
||||
+cc_library(
|
||||
+ name = "log",
|
||||
+ deps = [
|
||||
+ ],
|
||||
+)
|
||||
+
|
||||
+cc_library(
|
||||
+ name = "log_entry",
|
||||
+ deps = [
|
||||
+ "//absl/base:config",
|
||||
+ "//absl/base:core_headers",
|
||||
+ "//absl/base:log_severity",
|
||||
+ "//absl/strings",
|
||||
+ "//absl/time",
|
||||
+ "//absl/types:span",
|
||||
+ ],
|
||||
+)
|
||||
+
|
||||
+cc_library(
|
||||
+ name = "log_sink",
|
||||
+ deps = [
|
||||
+ ":log_entry",
|
||||
+ "//absl/base:config",
|
||||
+ ],
|
||||
+)
|
||||
+
|
||||
+cc_library(
|
||||
+ name = "log_sink_registry",
|
||||
+ deps = [
|
||||
+ ":log_sink",
|
||||
+ "//absl/base:config",
|
||||
+ ],
|
||||
+)
|
||||
+
|
||||
+cc_library(
|
||||
+ name = "log_streamer",
|
||||
+ deps = [
|
||||
+ ":absl_log",
|
||||
+ "//absl/base:config",
|
||||
+ "//absl/base:log_severity",
|
||||
+ "//absl/strings",
|
||||
+ "//absl/strings:internal",
|
||||
+ "//absl/types:optional",
|
||||
+ "//absl/utility",
|
||||
+ ],
|
||||
+)
|
||||
+
|
||||
+cc_library(
|
||||
+ name = "scoped_mock_log",
|
||||
+ deps = [
|
||||
+ ":log_entry",
|
||||
+ ":log_sink",
|
||||
+ ":log_sink_registry",
|
||||
+ "//absl/base:config",
|
||||
+ "//absl/base:log_severity",
|
||||
+ "//absl/base:raw_logging_internal",
|
||||
+ "//absl/strings",
|
||||
+ "@com_google_googletest//:gtest",
|
||||
+ ],
|
||||
+)
|
||||
+
|
||||
+cc_library(
|
||||
+ name = "structured",
|
||||
+ deps = [
|
||||
+ "//absl/base:config",
|
||||
+ "//absl/strings",
|
||||
+ ],
|
||||
+)
|
||||
diff -Naurd x/third_party/absl/workspace.bzl y/third_party/absl/workspace.bzl
|
||||
--- x/third_party/absl/workspace.bzl 2023-09-17 09:12:05.499753364 +0000
|
||||
+++ y/third_party/absl/workspace.bzl 2023-09-17 09:12:11.795762177 +0000
|
||||
@@ -20,6 +20,7 @@
|
||||
"flags",
|
||||
"functional",
|
||||
"hash",
|
||||
+ "log",
|
||||
"memory",
|
||||
"meta",
|
||||
"numeric",
|
||||
@@ -1,717 +0,0 @@
|
||||
{
|
||||
stdenv,
|
||||
#bazel_5,
|
||||
bazel,
|
||||
buildBazelPackage,
|
||||
lib,
|
||||
fetchFromGitHub,
|
||||
symlinkJoin,
|
||||
addDriverRunpath,
|
||||
fetchpatch,
|
||||
fetchzip,
|
||||
linkFarm,
|
||||
# Python deps
|
||||
buildPythonPackage,
|
||||
pythonAtLeast,
|
||||
python,
|
||||
# Python libraries
|
||||
numpy,
|
||||
tensorboard,
|
||||
abseil-cpp,
|
||||
absl-py,
|
||||
packaging,
|
||||
setuptools,
|
||||
wheel,
|
||||
google-pasta,
|
||||
opt-einsum,
|
||||
astunparse,
|
||||
h5py,
|
||||
termcolor,
|
||||
grpcio,
|
||||
six,
|
||||
wrapt,
|
||||
protobuf-python,
|
||||
tensorflow-estimator-bin,
|
||||
dill,
|
||||
flatbuffers-python,
|
||||
portpicker,
|
||||
tblib,
|
||||
typing-extensions,
|
||||
# Common deps
|
||||
git,
|
||||
pybind11,
|
||||
which,
|
||||
binutils,
|
||||
glibcLocales,
|
||||
cython,
|
||||
perl,
|
||||
# Common libraries
|
||||
jemalloc,
|
||||
mpi,
|
||||
gast,
|
||||
grpc,
|
||||
sqlite,
|
||||
boringssl,
|
||||
jsoncpp,
|
||||
nsync,
|
||||
curl,
|
||||
snappy-cpp,
|
||||
flatbuffers-core,
|
||||
icu,
|
||||
double-conversion,
|
||||
libpng,
|
||||
libjpeg_turbo,
|
||||
giflib,
|
||||
protobuf-core,
|
||||
# Upstream by default includes cuda support since tensorflow 1.15. We could do
|
||||
# that in nix as well. It would make some things easier and less confusing, but
|
||||
# it would also make the default tensorflow package unfree. See
|
||||
# https://groups.google.com/a/tensorflow.org/forum/#!topic/developers/iRCt5m4qUz0
|
||||
config,
|
||||
cudaSupport ? config.cudaSupport,
|
||||
cudaPackages,
|
||||
cudaCapabilities ? cudaPackages.flags.cudaCapabilities,
|
||||
mklSupport ? false,
|
||||
mkl,
|
||||
tensorboardSupport ? true,
|
||||
# XLA without CUDA is broken
|
||||
xlaSupport ? cudaSupport,
|
||||
sse42Support ? stdenv.hostPlatform.sse4_2Support,
|
||||
avx2Support ? stdenv.hostPlatform.avx2Support,
|
||||
fmaSupport ? stdenv.hostPlatform.fmaSupport,
|
||||
cctools,
|
||||
llvmPackages,
|
||||
}:
|
||||
|
||||
let
|
||||
originalStdenv = stdenv;
|
||||
in
|
||||
let
|
||||
# Tensorflow looks at many toolchain-related variables which may diverge.
|
||||
#
|
||||
# Toolchain for cuda-enabled builds.
|
||||
# We want to achieve two things:
|
||||
# 1. NVCC should use a compatible back-end (e.g. gcc11 for cuda11)
|
||||
# 2. Normal C++ files should be compiled with the same toolchain,
|
||||
# to avoid potential weird dynamic linkage errors at runtime.
|
||||
# This may not be necessary though
|
||||
#
|
||||
# Toolchain for Darwin:
|
||||
# clang 7 fails to emit a symbol for
|
||||
# __ZN4llvm11SmallPtrSetIPKNS_10AllocaInstELj8EED1Ev in any of the
|
||||
# translation units, so the build fails at link time
|
||||
stdenv =
|
||||
if cudaSupport then
|
||||
cudaPackages.backendStdenv
|
||||
else if originalStdenv.hostPlatform.isDarwin then
|
||||
llvmPackages.stdenv
|
||||
else
|
||||
originalStdenv;
|
||||
inherit (cudaPackages) cudatoolkit nccl;
|
||||
# use compatible cuDNN (https://www.tensorflow.org/install/source#gpu)
|
||||
# cudaPackages.cudnn led to this:
|
||||
# https://github.com/tensorflow/tensorflow/issues/60398
|
||||
#cudnnAttribute = "cudnn_8_6";
|
||||
cudnnAttribute = "cudnn";
|
||||
cudnnMerged = symlinkJoin {
|
||||
name = "cudnn-merged";
|
||||
paths = [
|
||||
(lib.getDev cudaPackages.${cudnnAttribute})
|
||||
(lib.getLib cudaPackages.${cudnnAttribute})
|
||||
];
|
||||
};
|
||||
gentoo-patches = fetchzip {
|
||||
url = "https://dev.gentoo.org/~perfinion/patches/tensorflow-patches-2.12.0.tar.bz2";
|
||||
hash = "sha256-SCRX/5/zML7LmKEPJkcM5Tebez9vv/gmE4xhT/jyqWs=";
|
||||
};
|
||||
protobuf-extra = linkFarm "protobuf-extra" [
|
||||
{
|
||||
name = "include";
|
||||
path = protobuf-core.src;
|
||||
}
|
||||
];
|
||||
|
||||
withTensorboard = tensorboardSupport;
|
||||
|
||||
cudaComponents = with cudaPackages; [
|
||||
(cuda_nvcc.__spliced.buildHost or cuda_nvcc)
|
||||
(cuda_nvprune.__spliced.buildHost or cuda_nvprune)
|
||||
cccl # block_load.cuh
|
||||
cuda_cudart # cuda.h
|
||||
cuda_cupti # cupti.h
|
||||
cuda_nvcc # See https://github.com/google/jax/issues/19811
|
||||
cuda_nvml_dev # nvml.h
|
||||
cuda_nvtx # nvToolsExt.h
|
||||
libcublas # cublas_api.h
|
||||
libcufft # cufft.h
|
||||
libcurand # curand.h
|
||||
libcusolver # cusolver_common.h
|
||||
libcusparse # cusparse.h
|
||||
];
|
||||
|
||||
cudatoolkitDevMerged = symlinkJoin {
|
||||
name = "cuda-${cudaPackages.cudaMajorMinorVersion}-dev-merged";
|
||||
paths = lib.concatMap (p: [
|
||||
(lib.getBin p)
|
||||
(lib.getDev p)
|
||||
(lib.getLib p)
|
||||
(lib.getOutput "static" p) # Makes for a very fat closure
|
||||
]) cudaComponents;
|
||||
};
|
||||
|
||||
# Tensorflow expects bintools at hard-coded paths, e.g. /usr/bin/ar
|
||||
# The only way to overcome that is to set GCC_HOST_COMPILER_PREFIX,
|
||||
# but that path must contain cc as well, so we merge them
|
||||
cudatoolkit_cc_joined = symlinkJoin {
|
||||
name = "${stdenv.cc.name}-merged";
|
||||
paths = [
|
||||
stdenv.cc
|
||||
binutils.bintools # for ar, dwp, nm, objcopy, objdump, strip
|
||||
];
|
||||
};
|
||||
|
||||
# Needed for _some_ system libraries, grep INCLUDEDIR.
|
||||
includes_joined = symlinkJoin {
|
||||
name = "tensorflow-deps-merged";
|
||||
paths = [ jsoncpp ];
|
||||
};
|
||||
|
||||
tfFeature = x: if x then "1" else "0";
|
||||
|
||||
version = "2.13.0";
|
||||
format = "setuptools";
|
||||
variant = lib.optionalString cudaSupport "-gpu";
|
||||
pname = "tensorflow${variant}";
|
||||
|
||||
pythonEnv = python.withPackages (_: [
|
||||
# python deps needed during wheel build time (not runtime, see the buildPythonPackage part for that)
|
||||
# This list can likely be shortened, but each trial takes multiple hours so won't bother for now.
|
||||
absl-py
|
||||
astunparse
|
||||
dill
|
||||
flatbuffers-python
|
||||
gast
|
||||
google-pasta
|
||||
grpcio
|
||||
h5py
|
||||
numpy
|
||||
opt-einsum
|
||||
packaging
|
||||
protobuf-python
|
||||
setuptools
|
||||
six
|
||||
tblib
|
||||
tensorboard
|
||||
tensorflow-estimator-bin
|
||||
termcolor
|
||||
typing-extensions
|
||||
wheel
|
||||
wrapt
|
||||
]);
|
||||
|
||||
rules_cc_darwin_patched = stdenv.mkDerivation {
|
||||
pname = "rules_cc-${pname}";
|
||||
inherit version;
|
||||
|
||||
src = _bazel-build.deps;
|
||||
|
||||
prePatch = "pushd rules_cc";
|
||||
patches = [
|
||||
# https://github.com/bazelbuild/rules_cc/issues/122
|
||||
(fetchpatch {
|
||||
name = "tensorflow-rules_cc-libtool-path.patch";
|
||||
url = "https://github.com/bazelbuild/rules_cc/commit/8c427ab30bf213630dc3bce9d2e9a0e29d1787db.diff";
|
||||
hash = "sha256-C4v6HY5+jm0ACUZ58gBPVejCYCZfuzYKlHZ0m2qDHCk=";
|
||||
})
|
||||
|
||||
# https://github.com/bazelbuild/rules_cc/pull/124
|
||||
(fetchpatch {
|
||||
name = "tensorflow-rules_cc-install_name_tool-path.patch";
|
||||
url = "https://github.com/bazelbuild/rules_cc/commit/156497dc89100db8a3f57b23c63724759d431d05.diff";
|
||||
hash = "sha256-NES1KeQmMiUJQVoV6dS4YGRxxkZEjOpFSCyOq9HZYO0=";
|
||||
})
|
||||
];
|
||||
postPatch = "popd";
|
||||
|
||||
dontConfigure = true;
|
||||
dontBuild = true;
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
mv rules_cc/ "$out"
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
};
|
||||
llvm-raw_darwin_patched = stdenv.mkDerivation {
|
||||
pname = "llvm-raw-${pname}";
|
||||
inherit version;
|
||||
|
||||
src = _bazel-build.deps;
|
||||
|
||||
prePatch = "pushd llvm-raw";
|
||||
patches = [
|
||||
# Fix a vendored config.h that requires the 10.13 SDK
|
||||
./llvm_bazel_fix_macos_10_12_sdk.patch
|
||||
];
|
||||
postPatch = ''
|
||||
touch {BUILD,WORKSPACE}
|
||||
popd
|
||||
'';
|
||||
|
||||
dontConfigure = true;
|
||||
dontBuild = true;
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
mv llvm-raw/ "$out"
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
};
|
||||
bazel-build =
|
||||
if stdenv.hostPlatform.isDarwin then
|
||||
_bazel-build.overrideAttrs (prev: {
|
||||
bazelFlags = prev.bazelFlags ++ [
|
||||
"--override_repository=rules_cc=${rules_cc_darwin_patched}"
|
||||
"--override_repository=llvm-raw=${llvm-raw_darwin_patched}"
|
||||
];
|
||||
preBuild = ''
|
||||
export AR="${cctools}/bin/libtool"
|
||||
'';
|
||||
})
|
||||
else
|
||||
_bazel-build;
|
||||
|
||||
_bazel-build = buildBazelPackage.override { inherit stdenv; } {
|
||||
inherit pname version;
|
||||
#bazel = bazel_5;
|
||||
bazel = bazel;
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "tensorflow";
|
||||
repo = "tensorflow";
|
||||
tag = "v${version}";
|
||||
hash = "sha256-Rq5pAVmxlWBVnph20fkAwbfy+iuBNlfFy14poDPd5h0=";
|
||||
};
|
||||
|
||||
# On update, it can be useful to steal the changes from gentoo
|
||||
# https://gitweb.gentoo.org/repo/gentoo.git/tree/sci-libs/tensorflow
|
||||
|
||||
nativeBuildInputs = [
|
||||
which
|
||||
pythonEnv
|
||||
cython
|
||||
perl
|
||||
protobuf-core
|
||||
protobuf-extra
|
||||
]
|
||||
++ lib.optional cudaSupport addDriverRunpath;
|
||||
|
||||
buildInputs = [
|
||||
jemalloc
|
||||
mpi
|
||||
glibcLocales
|
||||
git
|
||||
|
||||
# libs taken from system through the TF_SYS_LIBS mechanism
|
||||
abseil-cpp
|
||||
boringssl
|
||||
curl
|
||||
double-conversion
|
||||
flatbuffers-core
|
||||
giflib
|
||||
grpc
|
||||
# Necessary to fix the "`GLIBCXX_3.4.30' not found" error
|
||||
(icu.override { inherit stdenv; })
|
||||
jsoncpp
|
||||
libjpeg_turbo
|
||||
libpng
|
||||
(pybind11.override (prev: {
|
||||
buildPythonPackage = prev.buildPythonPackage.override {
|
||||
inherit stdenv;
|
||||
};
|
||||
}))
|
||||
snappy-cpp
|
||||
sqlite
|
||||
]
|
||||
++ lib.optionals cudaSupport [
|
||||
cudatoolkit
|
||||
cudnnMerged
|
||||
]
|
||||
++ lib.optionals mklSupport [ mkl ]
|
||||
++ lib.optionals (!stdenv.hostPlatform.isDarwin) [ nsync ];
|
||||
|
||||
env = {
|
||||
# arbitrarily set to the current latest bazel version, overly careful
|
||||
TF_IGNORE_MAX_BAZEL_VERSION = true;
|
||||
|
||||
LIBTOOL = lib.optionalString stdenv.hostPlatform.isDarwin "${cctools}/bin/libtool";
|
||||
|
||||
# Take as many libraries from the system as possible. Keep in sync with
|
||||
# list of valid syslibs in
|
||||
# https://github.com/tensorflow/tensorflow/blob/master/third_party/systemlibs/syslibs_configure.bzl
|
||||
TF_SYSTEM_LIBS = lib.concatStringsSep "," (
|
||||
[
|
||||
"absl_py"
|
||||
"astor_archive"
|
||||
"astunparse_archive"
|
||||
"boringssl"
|
||||
"com_google_absl"
|
||||
# Not packaged in nixpkgs
|
||||
# "com_github_googleapis_googleapis"
|
||||
# "com_github_googlecloudplatform_google_cloud_cpp"
|
||||
"com_github_grpc_grpc"
|
||||
"com_google_protobuf"
|
||||
# Fails with the error: external/org_tensorflow/tensorflow/core/profiler/utils/tf_op_utils.cc:46:49: error: no matching function for call to 're2::RE2::FullMatch(absl::lts_2020_02_25::string_view&, re2::RE2&)'
|
||||
# "com_googlesource_code_re2"
|
||||
"curl"
|
||||
"cython"
|
||||
"dill_archive"
|
||||
"double_conversion"
|
||||
"flatbuffers"
|
||||
"functools32_archive"
|
||||
"gast_archive"
|
||||
"gif"
|
||||
"hwloc"
|
||||
"icu"
|
||||
"jsoncpp_git"
|
||||
"libjpeg_turbo"
|
||||
"nasm"
|
||||
"opt_einsum_archive"
|
||||
"org_sqlite"
|
||||
"pasta"
|
||||
"png"
|
||||
"pybind11"
|
||||
"six_archive"
|
||||
"snappy"
|
||||
"tblib_archive"
|
||||
"termcolor_archive"
|
||||
"typing_extensions_archive"
|
||||
"wrapt"
|
||||
"zlib"
|
||||
]
|
||||
++ lib.optionals (!stdenv.hostPlatform.isDarwin) [
|
||||
"nsync" # fails to build on darwin
|
||||
]
|
||||
);
|
||||
|
||||
INCLUDEDIR = "${includes_joined}/include";
|
||||
|
||||
# This is needed for the Nix-provided protobuf dependency to work,
|
||||
# as otherwise the rule `link_proto_files` tries to create the links
|
||||
# to `/usr/include/...` which results in build failures.
|
||||
PROTOBUF_INCLUDE_PATH = "${protobuf-core}/include";
|
||||
|
||||
PYTHON_BIN_PATH = pythonEnv.interpreter;
|
||||
|
||||
TF_NEED_GCP = true;
|
||||
TF_NEED_HDFS = true;
|
||||
TF_ENABLE_XLA = tfFeature xlaSupport;
|
||||
|
||||
CC_OPT_FLAGS = " ";
|
||||
|
||||
# https://github.com/tensorflow/tensorflow/issues/14454
|
||||
TF_NEED_MPI = tfFeature cudaSupport;
|
||||
|
||||
TF_NEED_CUDA = tfFeature cudaSupport;
|
||||
TF_CUDA_PATHS = lib.optionalString cudaSupport "${cudatoolkitDevMerged},${cudnnMerged},${lib.getLib nccl}";
|
||||
TF_CUDA_COMPUTE_CAPABILITIES = lib.concatStringsSep "," cudaCapabilities;
|
||||
|
||||
# Needed even when we override stdenv: e.g. for ar
|
||||
GCC_HOST_COMPILER_PREFIX = lib.optionalString cudaSupport "${cudatoolkit_cc_joined}/bin";
|
||||
GCC_HOST_COMPILER_PATH = lib.optionalString cudaSupport "${cudatoolkit_cc_joined}/bin/cc";
|
||||
|
||||
# https://github.com/tensorflow/tensorflow/pull/39470
|
||||
NIX_CFLAGS_COMPILE = toString [ "-Wno-stringop-truncation" ];
|
||||
};
|
||||
|
||||
patches = [
|
||||
"${gentoo-patches}/0002-systemlib-Latest-absl-LTS-has-split-cord-libs.patch"
|
||||
"${gentoo-patches}/0005-systemlib-Updates-for-Abseil-20220623-LTS.patch"
|
||||
"${gentoo-patches}/0007-systemlibs-Add-well_known_types_py_pb2-target.patch"
|
||||
# https://github.com/conda-forge/tensorflow-feedstock/pull/329/commits/0a63c5a962451b4da99a9948323d8b3ed462f461
|
||||
(fetchpatch {
|
||||
name = "fix-layout-proto-duplicate-loading.patch";
|
||||
url = "https://raw.githubusercontent.com/conda-forge/tensorflow-feedstock/0a63c5a962451b4da99a9948323d8b3ed462f461/recipe/patches/0001-Omit-linking-to-layout_proto_cc-if-protobuf-linkage-.patch";
|
||||
hash = "sha256-/7buV6DinKnrgfqbe7KKSh9rCebeQdXv2Uj+Xg/083w=";
|
||||
})
|
||||
./com_google_absl_add_log.patch
|
||||
./absl_py_argparse_flags.patch
|
||||
./protobuf_python.patch
|
||||
./pybind11_protobuf_python_runtime_dep.patch
|
||||
./pybind11_protobuf_newer_version.patch
|
||||
]
|
||||
++ lib.optionals (stdenv.hostPlatform.system == "aarch64-darwin") [ ./absl_to_std.patch ];
|
||||
|
||||
postPatch = ''
|
||||
# bazel 3.3 should work just as well as bazel 3.1
|
||||
rm -f .bazelversion
|
||||
patchShebangs .
|
||||
''
|
||||
+ lib.optionalString (!withTensorboard) ''
|
||||
# Tensorboard pulls in a bunch of dependencies, some of which may
|
||||
# include security vulnerabilities. So we make it optional.
|
||||
# https://github.com/tensorflow/tensorflow/issues/20280#issuecomment-400230560
|
||||
sed -i '/tensorboard ~=/d' tensorflow/tools/pip_package/setup.py
|
||||
'';
|
||||
|
||||
preConfigure =
|
||||
let
|
||||
opt_flags =
|
||||
[ ]
|
||||
++ lib.optionals sse42Support [ "-msse4.2" ]
|
||||
++ lib.optionals avx2Support [ "-mavx2" ]
|
||||
++ lib.optionals fmaSupport [ "-mfma" ];
|
||||
in
|
||||
''
|
||||
patchShebangs configure
|
||||
|
||||
# dummy ldconfig
|
||||
mkdir dummy-ldconfig
|
||||
echo "#!${stdenv.shell}" > dummy-ldconfig/ldconfig
|
||||
chmod +x dummy-ldconfig/ldconfig
|
||||
export PATH="$PWD/dummy-ldconfig:$PATH"
|
||||
|
||||
export PYTHON_LIB_PATH="$NIX_BUILD_TOP/site-packages"
|
||||
export CC_OPT_FLAGS="${lib.concatStringsSep " " opt_flags}"
|
||||
mkdir -p "$PYTHON_LIB_PATH"
|
||||
|
||||
# To avoid mixing Python 2 and Python 3
|
||||
unset PYTHONPATH
|
||||
'';
|
||||
|
||||
configurePhase = ''
|
||||
runHook preConfigure
|
||||
./configure
|
||||
runHook postConfigure
|
||||
'';
|
||||
|
||||
hardeningDisable = [ "format" ];
|
||||
|
||||
bazelBuildFlags = [
|
||||
"--config=opt" # optimize using the flags set in the configure phase
|
||||
]
|
||||
++ lib.optionals stdenv.cc.isClang [
|
||||
"--cxxopt=-x"
|
||||
"--cxxopt=c++"
|
||||
"--host_cxxopt=-x"
|
||||
"--host_cxxopt=c++"
|
||||
|
||||
# workaround for https://github.com/bazelbuild/bazel/issues/15359
|
||||
"--spawn_strategy=sandboxed"
|
||||
]
|
||||
++ lib.optionals mklSupport [ "--config=mkl" ];
|
||||
|
||||
bazelTargets = [
|
||||
"//tensorflow/tools/pip_package:build_pip_package //tensorflow/tools/lib_package:libtensorflow"
|
||||
];
|
||||
|
||||
removeRulesCC = false;
|
||||
# Without this Bazel complaints about sandbox violations.
|
||||
dontAddBazelOpts = true;
|
||||
|
||||
fetchAttrs = {
|
||||
sha256 =
|
||||
{
|
||||
x86_64-linux =
|
||||
if cudaSupport then
|
||||
"sha256-5VFMNHeLrUxW5RTr6EhT3pay9nWJ5JkZTGirDds5QkU="
|
||||
else
|
||||
"sha256-KzgWV69Btr84FdwQ5JI2nQEsqiPg1/+TWdbw5bmxXOE=";
|
||||
aarch64-linux =
|
||||
if cudaSupport then
|
||||
"sha256-ty5+51BwHWE1xR4/0WcWTp608NzSAS/iiyN+9zx7/wI="
|
||||
else
|
||||
"sha256-9btXrNHqd720oXTPDhSmFidv5iaZRLjCVX8opmrMjXk=";
|
||||
aarch64-darwin = "sha256-WdgAaFZU+ePwWkVBhLzjlNT7ELfGHOTaMdafcAMD5yo=";
|
||||
}
|
||||
.${stdenv.hostPlatform.system} or (throw "unsupported system ${stdenv.hostPlatform.system}");
|
||||
};
|
||||
|
||||
buildAttrs = {
|
||||
outputs = [
|
||||
"out"
|
||||
"python"
|
||||
];
|
||||
|
||||
# need to rebuild schemas since we use a different flatbuffers version
|
||||
preBuild = ''
|
||||
(cd tensorflow/lite/schema;${flatbuffers-core}/bin/flatc --gen-object-api -c schema.fbs)
|
||||
(cd tensorflow/lite/schema;${flatbuffers-core}/bin/flatc --gen-object-api -c conversion_metadata.fbs)
|
||||
(cd tensorflow/lite/acceleration/configuration;${flatbuffers-core}/bin/flatc -o configuration.fbs --proto configuration.proto)
|
||||
sed -i s,tflite.proto,tflite,g tensorflow/lite/acceleration/configuration/configuration.fbs/configuration.fbs
|
||||
(cd tensorflow/lite/acceleration/configuration;${flatbuffers-core}/bin/flatc --gen-compare --gen-object-api -c configuration.fbs/configuration.fbs)
|
||||
cp -r tensorflow/lite/acceleration/configuration/configuration.fbs tensorflow/lite/experimental/acceleration/configuration
|
||||
(cd tensorflow/lite/experimental/acceleration/configuration;${flatbuffers-core}/bin/flatc -c configuration.fbs/configuration.fbs)
|
||||
(cd tensorflow/lite/delegates/gpu/cl;${flatbuffers-core}/bin/flatc -c compiled_program_cache.fbs)
|
||||
(cd tensorflow/lite/delegates/gpu/cl;${flatbuffers-core}/bin/flatc -I $NIX_BUILD_TOP/source -c serialization.fbs)
|
||||
(cd tensorflow/lite/delegates/gpu/common;${flatbuffers-core}/bin/flatc -I $NIX_BUILD_TOP/source -c gpu_model.fbs)
|
||||
(cd tensorflow/lite/delegates/gpu/common/task;${flatbuffers-core}/bin/flatc -c serialization_base.fbs)
|
||||
patchShebangs .
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p "$out"
|
||||
tar -xf bazel-bin/tensorflow/tools/lib_package/libtensorflow.tar.gz -C "$out"
|
||||
# Write pkgconfig file.
|
||||
mkdir "$out/lib/pkgconfig"
|
||||
cat > "$out/lib/pkgconfig/tensorflow.pc" << EOF
|
||||
Name: TensorFlow
|
||||
Version: ${version}
|
||||
Description: Library for computation using data flow graphs for scalable machine learning
|
||||
Requires:
|
||||
Libs: -L$out/lib -ltensorflow
|
||||
Cflags: -I$out/include/tensorflow
|
||||
EOF
|
||||
|
||||
# build the source code, then copy it to $python (build_pip_package
|
||||
# actually builds a symlink farm so we must dereference them).
|
||||
bazel-bin/tensorflow/tools/pip_package/build_pip_package --src "$PWD/dist"
|
||||
cp -Lr "$PWD/dist" "$python"
|
||||
'';
|
||||
|
||||
postFixup = lib.optionalString cudaSupport ''
|
||||
find $out -type f \( -name '*.so' -or -name '*.so.*' \) | while read lib; do
|
||||
addDriverRunpath "$lib"
|
||||
done
|
||||
'';
|
||||
|
||||
requiredSystemFeatures = [ "big-parallel" ];
|
||||
};
|
||||
|
||||
meta = {
|
||||
badPlatforms = lib.optionals cudaSupport lib.platforms.darwin;
|
||||
changelog = "https://github.com/tensorflow/tensorflow/releases/tag/v${version}";
|
||||
description = "Computation using data flow graphs for scalable machine learning";
|
||||
homepage = "http://tensorflow.org";
|
||||
license = lib.licenses.asl20;
|
||||
maintainers = [ ];
|
||||
platforms = with lib.platforms; linux ++ darwin;
|
||||
broken =
|
||||
# Dependencies are EOL and have been removed; an update
|
||||
# to a newer TensorFlow version will be required to fix the
|
||||
# source build.
|
||||
true
|
||||
|| stdenv.hostPlatform.isDarwin
|
||||
|| !(xlaSupport -> cudaSupport)
|
||||
|| !(cudaSupport -> builtins.hasAttr cudnnAttribute cudaPackages)
|
||||
|| !(cudaSupport -> cudaPackages ? cudatoolkit);
|
||||
}
|
||||
// lib.optionalAttrs stdenv.hostPlatform.isDarwin {
|
||||
timeout = 86400; # 24 hours
|
||||
maxSilent = 14400; # 4h, double the default of 7200s
|
||||
};
|
||||
};
|
||||
in
|
||||
buildPythonPackage {
|
||||
__structuredAttrs = true;
|
||||
inherit version pname format;
|
||||
disabled = pythonAtLeast "3.13";
|
||||
|
||||
src = bazel-build.python;
|
||||
|
||||
# Adjust dependency requirements:
|
||||
# - Drop tensorflow-io dependency until we get it to build
|
||||
# - Relax flatbuffers and gast version requirements
|
||||
# - The purpose of python3Packages.libclang is not clear at the moment and we don't have it packaged yet
|
||||
# - keras will be considered as optional for now.
|
||||
postPatch = ''
|
||||
sed -i setup.py \
|
||||
-e '/tensorflow-io-gcs-filesystem/,+1d' \
|
||||
-e "s/'flatbuffers[^']*',/'flatbuffers',/" \
|
||||
-e "s/'gast[^']*',/'gast',/" \
|
||||
-e "/'libclang[^']*',/d" \
|
||||
-e "/'keras[^']*')\?,/d" \
|
||||
-e "s/'protobuf[^']*',/'protobuf',/"
|
||||
'';
|
||||
|
||||
postInstall =
|
||||
# Upstream has a pip hack that results in bin/tensorboard being in both tensorflow
|
||||
# and the propagated input tensorboard, which causes environment collisions.
|
||||
# Another possibility would be to have tensorboard only in the buildInputs
|
||||
# https://github.com/tensorflow/tensorflow/blob/v1.7.1/tensorflow/tools/pip_package/setup.py#L79
|
||||
''
|
||||
rm $out/bin/tensorboard
|
||||
''
|
||||
# Don't set RTLD_GLOBAL by removing file only meant to ship in static builds.
|
||||
# https://github.com/tensorflow/tensorflow/commit/5720ab7845de0b2a2e2f5fdf547d2515d39a20b9
|
||||
+ ''
|
||||
rm $out/${python.sitePackages}/tensorflow/python/pywrap_dlopen_global_flags.py
|
||||
'';
|
||||
|
||||
setupPyGlobalFlags = [
|
||||
"--project_name"
|
||||
pname
|
||||
];
|
||||
|
||||
# tensorflow/tools/pip_package/setup.py
|
||||
propagatedBuildInputs = [
|
||||
absl-py
|
||||
abseil-cpp
|
||||
astunparse
|
||||
flatbuffers-python
|
||||
gast
|
||||
google-pasta
|
||||
grpcio
|
||||
h5py
|
||||
numpy
|
||||
opt-einsum
|
||||
packaging
|
||||
protobuf-python
|
||||
six
|
||||
tensorflow-estimator-bin
|
||||
termcolor
|
||||
typing-extensions
|
||||
wrapt
|
||||
]
|
||||
++ lib.optionals withTensorboard [ tensorboard ];
|
||||
|
||||
nativeBuildInputs = lib.optionals cudaSupport [ addDriverRunpath ];
|
||||
|
||||
postFixup = lib.optionalString cudaSupport ''
|
||||
find $out -type f \( -name '*.so' -or -name '*.so.*' \) | while read lib; do
|
||||
addDriverRunpath "$lib"
|
||||
|
||||
patchelf --set-rpath "${cudatoolkit}/lib:${cudatoolkit.lib}/lib:${cudnnMerged}/lib:${lib.getLib nccl}/lib:$(patchelf --print-rpath "$lib")" "$lib"
|
||||
done
|
||||
'';
|
||||
|
||||
# Actual tests are slow and impure.
|
||||
# TODO try to run them anyway
|
||||
# TODO better test (files in tensorflow/tools/ci_build/builds/*test)
|
||||
# TEST_PACKAGES in tensorflow/tools/pip_package/setup.py
|
||||
nativeCheckInputs = [
|
||||
dill
|
||||
portpicker
|
||||
tblib
|
||||
];
|
||||
checkPhase = ''
|
||||
${python.interpreter} <<EOF
|
||||
# A simple "Hello world"
|
||||
import tensorflow as tf
|
||||
hello = tf.constant("Hello, world!")
|
||||
tf.print(hello)
|
||||
|
||||
tf.random.set_seed(0)
|
||||
width = 512
|
||||
choice = 48
|
||||
t_in = tf.Variable(tf.random.uniform(shape=[width]))
|
||||
with tf.GradientTape() as tape:
|
||||
t_out = tf.slice(tf.nn.softmax(t_in), [choice], [1])
|
||||
diff = tape.gradient(t_out, t_in)
|
||||
assert(0 < tf.reduce_min(tf.slice(diff, [choice], [1])))
|
||||
assert(0 > tf.reduce_max(tf.slice(diff, [1], [choice - 1])))
|
||||
EOF
|
||||
'';
|
||||
# Regression test for #77626 removed because not more `tensorflow.contrib`.
|
||||
|
||||
passthru = {
|
||||
deps = bazel-build.deps;
|
||||
libtensorflow = bazel-build.out;
|
||||
};
|
||||
|
||||
inherit (bazel-build) meta;
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
diff -ru a/utils/bazel/llvm-project-overlay/llvm/include/llvm/Config/config.h b/utils/bazel/llvm-project-overlay/llvm/include/llvm/Config/config.h
|
||||
--- a/utils/bazel/llvm-project-overlay/llvm/include/llvm/Config/config.h 2021-09-21 15:57:02.000000000 -0400
|
||||
+++ b/utils/bazel/llvm-project-overlay/llvm/include/llvm/Config/config.h 2021-11-20 18:48:48.000000000 -0500
|
||||
@@ -102,7 +102,7 @@
|
||||
/* #undef HAVE_FFI_H */
|
||||
|
||||
/* Define to 1 if you have the `futimens' function. */
|
||||
-#define HAVE_FUTIMENS 1
|
||||
+/* #define HAVE_FUTIMENS 1 */
|
||||
|
||||
/* Define to 1 if you have the `futimes' function. */
|
||||
#define HAVE_FUTIMES 1
|
||||
@@ -1,19 +0,0 @@
|
||||
diff -Naurd x/tensorflow/workspace2.bzl y/tensorflow/workspace2.bzl
|
||||
--- x/tensorflow/workspace2.bzl 2023-09-16 20:44:02.266422132 +0000
|
||||
+++ y/tensorflow/workspace2.bzl 2023-09-16 20:50:40.370998305 +0000
|
||||
@@ -469,6 +469,7 @@
|
||||
system_link_files = {
|
||||
"//third_party/systemlibs:protobuf.bzl": "protobuf.bzl",
|
||||
"//third_party/systemlibs:protobuf_deps.bzl": "protobuf_deps.bzl",
|
||||
+ "//third_party/systemlibs:protobuf.python.BUILD": "python/BUILD",
|
||||
},
|
||||
urls = tf_mirror_urls("https://github.com/protocolbuffers/protobuf/archive/v3.21.9.zip"),
|
||||
)
|
||||
diff -Naurd x/third_party/systemlibs/protobuf.python.BUILD y/third_party/systemlibs/protobuf.python.BUILD
|
||||
--- x/third_party/systemlibs/protobuf.python.BUILD 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ y/third_party/systemlibs/protobuf.python.BUILD 2023-09-16 20:49:12.514890584 +0000
|
||||
@@ -0,0 +1,4 @@
|
||||
+cc_library(
|
||||
+ name = "proto_api",
|
||||
+ visibility = ["//visibility:public"]
|
||||
+)
|
||||
@@ -1,16 +0,0 @@
|
||||
diff -Naurd x/tensorflow/workspace2.bzl y/tensorflow/workspace2.bzl
|
||||
--- x/tensorflow/workspace2.bzl 2023-09-21 12:55:06.104407343 +0000
|
||||
+++ y/tensorflow/workspace2.bzl 2023-09-21 12:55:39.732453203 +0000
|
||||
@@ -872,9 +872,9 @@
|
||||
|
||||
tf_http_archive(
|
||||
name = "pybind11_protobuf",
|
||||
- urls = tf_mirror_urls("https://github.com/pybind/pybind11_protobuf/archive/80f3440cd8fee124e077e2e47a8a17b78b451363.zip"),
|
||||
- sha256 = "c7ab64b1ccf9a678694a89035a8c865a693e4e872803778f91f0965c2f281d78",
|
||||
- strip_prefix = "pybind11_protobuf-80f3440cd8fee124e077e2e47a8a17b78b451363",
|
||||
+ urls = tf_mirror_urls("https://github.com/pybind/pybind11_protobuf/archive/c8cc30e2495309e3499b7d76033446236d21c837.zip"),
|
||||
+ sha256 = "0663f73b34c0b4af55003edbb066e62aceff99bfcf12e47ea9a15d6013d81413",
|
||||
+ strip_prefix = "pybind11_protobuf-c8cc30e2495309e3499b7d76033446236d21c837",
|
||||
patch_file = [
|
||||
"//third_party/pybind11_protobuf:remove_license.patch",
|
||||
"//third_party/pybind11_protobuf:python_runtime_dep.patch",
|
||||
@@ -1,30 +0,0 @@
|
||||
diff -Naurd x/tensorflow/workspace2.bzl y/tensorflow/workspace2.bzl
|
||||
--- x/tensorflow/workspace2.bzl 2023-09-17 22:22:22.029075202 +0000
|
||||
+++ y/tensorflow/workspace2.bzl 2023-09-17 22:25:27.501289587 +0000
|
||||
@@ -876,7 +876,10 @@
|
||||
urls = tf_mirror_urls("https://github.com/pybind/pybind11_protobuf/archive/80f3440cd8fee124e077e2e47a8a17b78b451363.zip"),
|
||||
sha256 = "c7ab64b1ccf9a678694a89035a8c865a693e4e872803778f91f0965c2f281d78",
|
||||
strip_prefix = "pybind11_protobuf-80f3440cd8fee124e077e2e47a8a17b78b451363",
|
||||
- patch_file = ["//third_party/pybind11_protobuf:remove_license.patch"],
|
||||
+ patch_file = [
|
||||
+ "//third_party/pybind11_protobuf:remove_license.patch",
|
||||
+ "//third_party/pybind11_protobuf:python_runtime_dep.patch",
|
||||
+ ],
|
||||
)
|
||||
|
||||
tf_http_archive(
|
||||
diff -Naurd x/third_party/pybind11_protobuf/python_runtime_dep.patch y/third_party/pybind11_protobuf/python_runtime_dep.patch
|
||||
--- x/third_party/pybind11_protobuf/python_runtime_dep.patch 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ y/third_party/pybind11_protobuf/python_runtime_dep.patch 2023-09-17 22:23:07.849128180 +0000
|
||||
@@ -0,0 +1,11 @@
|
||||
+diff -Naurd x/pybind11_protobuf/BUILD y/pybind11_protobuf/BUILD
|
||||
+--- x/pybind11_protobuf/BUILD 2023-09-17 22:17:19.932725814 +0000
|
||||
++++ y/pybind11_protobuf/BUILD 2023-09-17 22:20:44.056961932 +0000
|
||||
+@@ -86,6 +86,7 @@
|
||||
+ "//visibility:private",
|
||||
+ ],
|
||||
+ deps = [
|
||||
++ "@org_tensorflow//third_party/python_runtime:headers",
|
||||
+ "@com_google_absl//absl/container:flat_hash_map",
|
||||
+ "@com_google_absl//absl/container:flat_hash_set",
|
||||
+ "@com_google_absl//absl/meta:type_traits",
|
||||
@@ -1453,7 +1453,8 @@ mapAliases {
|
||||
libsoup_2_4 = throw "'libsoup_2_4' has been removed as it was end-of-life and has many known unfixed security issues. Consider migrating to 'libsoup_3' instead"; # Added 2026-06-07
|
||||
libtap = throw "libtap has been removed, as it was unused and deprecated by its author in favour of cmocka"; # Added 2025-09-16
|
||||
libtcod = throw "'libtcod' has been removed due to being unused and having an incompatible build-system"; # Added 2025-10-04
|
||||
libtensorflow-bin = throw "'libtensorflow-bin' has been renamed to/replaced by 'libtensorflow'"; # Converted to throw 2025-10-27
|
||||
libtensorflow = throw "'libtensorflow' has been removed as it was broken for years and unmaintained"; # Added 2026-10-07
|
||||
libtensorflow-bin = throw "'libtensorflow-bin' has been removed as it was broken for years and unmaintained"; # Converted to throw 2025-10-27
|
||||
libtool_1_5 = throw "'libtool_1_5' has been removed in favor of 'libtool'"; # Added 2026-09-22
|
||||
libtorrent = throw "'libtorrent' has been renamed to 'libtorrent-rakshasa' for clearer distinction from 'libtorrent-rasterbar'"; # Added 2025-09-10
|
||||
libtransmission = throw "libtransmission_3 has been removed in favour of libtransmission_4. Note that upgrade caused data loss for some users so backup is recommended (see NixOS 24.11 release notes for details)"; # Converted to throw 2025-10-26
|
||||
|
||||
@@ -1406,8 +1406,6 @@ with pkgs;
|
||||
charles5
|
||||
;
|
||||
|
||||
libtensorflow = python3.pkgs.tensorflow-build.libtensorflow;
|
||||
|
||||
libtorch-bin = callPackage ../development/libraries/science/math/libtorch/bin.nix { };
|
||||
|
||||
behave = with python3Packages; toPythonApplication behave;
|
||||
|
||||
@@ -741,11 +741,6 @@
|
||||
"tdlib"
|
||||
]
|
||||
},
|
||||
"tensorflow": {
|
||||
"attrPath": [
|
||||
"libtensorflow"
|
||||
]
|
||||
},
|
||||
"uuid": {
|
||||
"attrPath": [
|
||||
"libossp_uuid"
|
||||
|
||||
@@ -752,7 +752,8 @@ mapAliases {
|
||||
tbats = throw "'tbats' has been removed due to lack of upstream maintenance"; # Added 2026-05-11
|
||||
tbm-utils = throw "'tbm-utils' has been removed as it is unmaintained since 2020"; # Added 2026-03-12
|
||||
tensorflow-bin_2 = throw "'tensorflow-bin_2' has been renamed to/replaced by 'tensorflow-bin'"; # Converted to throw 2025-10-29
|
||||
tensorflow-build_2 = throw "'tensorflow-build_2' has been renamed to/replaced by 'tensorflow-build'"; # Converted to throw 2025-10-29
|
||||
tensorflow-build = throw "'tensorflow-build' has been removed as it was broken for years and unmaintained. Use 'tensorflow-bin' instead"; # Added 2026-10-07
|
||||
tensorflow-build_2 = throw "'tensorflow-build_2' has been removed as it was broken for years and unmaintained. Use 'tensorflow-bin' instead"; # Converted to throw 2025-10-29
|
||||
tensorflow-estimator = throw "'tensorflow-estimator' has been renamed to/replaced by 'tensorflow-estimator-bin'"; # Converted to throw 2025-10-29
|
||||
tensorflow-estimator_2 = throw "'tensorflow-estimator_2' has been renamed to/replaced by 'tensorflow-estimator'"; # Converted to throw 2025-10-29
|
||||
tensorflow-tensorboard = throw "'tensorflow-tensorboard' has been renamed to/replaced by 'tensorboard'"; # Converted to throw 2025-10-29
|
||||
|
||||
@@ -20529,63 +20529,6 @@ self: super: with self; {
|
||||
inherit (pkgs.config) cudaSupport;
|
||||
};
|
||||
|
||||
tensorflow-build =
|
||||
let
|
||||
compat = rec {
|
||||
#protobufTF = pkgs.protobuf_21.override { abseil-cpp = pkgs.abseil-cpp_202301; };
|
||||
protobufTF = pkgs.protobuf;
|
||||
# https://www.tensorflow.org/install/source#gpu
|
||||
#cudaPackagesTF = pkgs.cudaPackages_11;
|
||||
cudaPackagesTF = pkgs.cudaPackages;
|
||||
grpcTF =
|
||||
(pkgs.grpc.overrideAttrs (oldAttrs: rec {
|
||||
# nvcc fails on recent grpc versions, so we use the latest patch level
|
||||
# of the grpc version bundled by upstream tensorflow to allow CUDA
|
||||
# support
|
||||
version = "1.27.3";
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "grpc";
|
||||
repo = "grpc";
|
||||
rev = "v${version}";
|
||||
hash = "sha256-PpiOT4ZJe1uMp5j+ReQulC9jpT0xoR2sAl6vRYKA0AA=";
|
||||
fetchSubmodules = true;
|
||||
};
|
||||
patches = [ ];
|
||||
postPatch = ''
|
||||
sed -i "s/-std=c++11/-std=c++17/" CMakeLists.txt
|
||||
echo "set(CMAKE_CXX_STANDARD 17)" >> CMakeLists.txt
|
||||
'';
|
||||
})).override
|
||||
{ protobuf = protobufTF; };
|
||||
protobuf-pythonTF = self.protobuf4.override { protobuf = protobufTF; };
|
||||
grpcioTF = self.grpcio.override { protobuf = protobufTF; };
|
||||
tensorboardTF = self.tensorboard.override {
|
||||
grpcio = grpcioTF;
|
||||
protobuf = protobuf-pythonTF;
|
||||
};
|
||||
};
|
||||
in
|
||||
callPackage ../development/python-modules/tensorflow {
|
||||
inherit (pkgs.config) cudaSupport;
|
||||
flatbuffers-core = pkgs.flatbuffers;
|
||||
flatbuffers-python = self.flatbuffers;
|
||||
cudaPackages = compat.cudaPackagesTF;
|
||||
protobuf-core = compat.protobufTF;
|
||||
protobuf-python = compat.protobuf-pythonTF;
|
||||
grpc = compat.grpcTF;
|
||||
grpcio = compat.grpcioTF;
|
||||
tensorboard = compat.tensorboardTF;
|
||||
#abseil-cpp = pkgs.abseil-cpp_202301;
|
||||
snappy-cpp = pkgs.snappy;
|
||||
|
||||
# Tensorflow 2.13 doesn't support gcc13:
|
||||
# https://github.com/tensorflow/tensorflow/issues/61289
|
||||
#
|
||||
# We use the nixpkgs' default libstdc++ to stay compatible with other
|
||||
# python modules
|
||||
#stdenv = pkgs.stdenvAdapters.useLibsFrom stdenv pkgs.gcc12Stdenv;
|
||||
};
|
||||
|
||||
tensorflow-datasets = callPackage ../development/python-modules/tensorflow-datasets { };
|
||||
|
||||
tensorflow-estimator-bin =
|
||||
|
||||
Reference in New Issue
Block a user