push sheeet
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s

This commit is contained in:
Dark Steveneq
2025-10-09 14:15:47 +02:00
commit 646b892680
49168 changed files with 5897842 additions and 0 deletions

View File

@@ -0,0 +1,47 @@
diff --git a/Makefile b/Makefile
index c823f66e..65b90c5e 100644
--- a/Makefile
+++ b/Makefile
@@ -32,9 +32,9 @@ SRC_DIRS := $(shell find * -type d -exec bash -c "find {} -maxdepth 1 \
LIBRARY_NAME := $(PROJECT)
LIB_BUILD_DIR := $(BUILD_DIR)/lib
STATIC_NAME := $(LIB_BUILD_DIR)/lib$(LIBRARY_NAME).a
-DYNAMIC_VERSION_MAJOR := 1
-DYNAMIC_VERSION_MINOR := 0
-DYNAMIC_VERSION_REVISION := 0
+DYNAMIC_VERSION_MAJOR := 1
+DYNAMIC_VERSION_MINOR := 0
+DYNAMIC_VERSION_REVISION := 0
DYNAMIC_NAME_SHORT := lib$(LIBRARY_NAME).so
#DYNAMIC_SONAME_SHORT := $(DYNAMIC_NAME_SHORT).$(DYNAMIC_VERSION_MAJOR)
DYNAMIC_VERSIONED_NAME_SHORT := $(DYNAMIC_NAME_SHORT).$(DYNAMIC_VERSION_MAJOR).$(DYNAMIC_VERSION_MINOR).$(DYNAMIC_VERSION_REVISION)
diff --git a/cmake/Dependencies.cmake b/cmake/Dependencies.cmake
index c48255c8..cf4c580e 100644
--- a/cmake/Dependencies.cmake
+++ b/cmake/Dependencies.cmake
@@ -105,7 +105,6 @@ if(USE_OPENCV)
endif()
# ---[ BLAS
-if(NOT APPLE)
set(BLAS "Atlas" CACHE STRING "Selected BLAS library")
set_property(CACHE BLAS PROPERTY STRINGS "Atlas;Open;MKL")
@@ -123,17 +122,6 @@ if(NOT APPLE)
list(APPEND Caffe_LINKER_LIBS PUBLIC ${MKL_LIBRARIES})
list(APPEND Caffe_DEFINITIONS PUBLIC -DUSE_MKL)
endif()
-elseif(APPLE)
- find_package(vecLib REQUIRED)
- list(APPEND Caffe_INCLUDE_DIRS PUBLIC ${vecLib_INCLUDE_DIR})
- list(APPEND Caffe_LINKER_LIBS PUBLIC ${vecLib_LINKER_LIBS})
-
- if(VECLIB_FOUND)
- if(NOT vecLib_INCLUDE_DIR MATCHES "^/System/Library/Frameworks/vecLib.framework.*")
- list(APPEND Caffe_DEFINITIONS PUBLIC -DUSE_ACCELERATE)
- endif()
- endif()
-endif()
# ---[ Python
if(BUILD_python)

View File

@@ -0,0 +1,182 @@
{
stdenv,
lib,
fetchFromGitHub,
fetchurl,
fetchpatch,
cmake,
boost,
gflags,
glog,
hdf5-cpp,
opencv4,
protobuf,
doxygen,
blas,
lmdbSupport ? true,
lmdb,
leveldbSupport ? true,
leveldb,
snappy,
pythonSupport ? false,
python ? null,
numpy ? null,
replaceVars,
}:
let
toggle = bool: if bool then "ON" else "OFF";
test_model_weights = fetchurl {
url = "http://dl.caffe.berkeleyvision.org/bvlc_reference_caffenet.caffemodel";
sha256 = "472d4a06035497b180636d8a82667129960371375bd10fcb6df5c6c7631f25e0";
};
in
stdenv.mkDerivation rec {
pname = "caffe";
version = "1.0";
src = fetchFromGitHub {
owner = "BVLC";
repo = "caffe";
rev = version;
sha256 = "104jp3cm823i3cdph7hgsnj6l77ygbwsy35mdmzhmsi4jxprd9j3";
};
nativeBuildInputs = [
cmake
doxygen
];
cmakeFlags =
# It's important that caffe is passed the major and minor version only because that's what
# boost_python expects
[
(if pythonSupport then "-Dpython_version=${python.pythonVersion}" else "-DBUILD_python=OFF")
"-DBLAS=open"
"-DCPU_ONLY=ON"
]
++ [ "-DUSE_LEVELDB=${toggle leveldbSupport}" ]
++ [ "-DUSE_LMDB=${toggle lmdbSupport}" ];
buildInputs = [
boost
gflags
glog
protobuf
hdf5-cpp
opencv4
blas
]
++ lib.optional lmdbSupport lmdb
++ lib.optionals leveldbSupport [
leveldb
snappy
]
++ lib.optionals pythonSupport [
python
numpy
];
propagatedBuildInputs = lib.optionals pythonSupport (
# requirements.txt
let
pp = python.pkgs;
in
(
[
pp.numpy
pp.scipy
pp.scikit-image
pp.h5py
pp.matplotlib
pp.ipython
pp.networkx
pp.pandas
pp.python-dateutil
pp.protobuf
pp.gflags
pp.pyyaml
pp.pillow
pp.six
]
++ lib.optional leveldbSupport pp.leveldb
)
);
outputs = [
"bin"
"out"
];
propagatedBuildOutputs = [ ]; # otherwise propagates out -> bin cycle
patches = [
./darwin.patch
./glog-cmake.patch
./random-shuffle.patch
(fetchpatch {
name = "support-opencv4";
url = "https://github.com/BVLC/caffe/pull/6638/commits/0a04cc2ccd37ba36843c18fea2d5cbae6e7dd2b5.patch";
hash = "sha256-ZegTvp0tTHlopQv+UzHDigs6XLkP2VfqLCWXl6aKJSI=";
})
]
++ lib.optional pythonSupport (
replaceVars ./python.patch {
inherit (python.sourceVersion) major minor; # Should be changed in case of PyPy
}
);
postPatch = ''
substituteInPlace src/caffe/util/io.cpp --replace \
'SetTotalBytesLimit(kProtoReadBytesLimit, 536870912)' \
'SetTotalBytesLimit(kProtoReadBytesLimit)'
'';
preConfigure = lib.optionalString pythonSupport ''
# We need this when building with Python bindings
export BOOST_LIBRARYDIR="${boost.out}/lib";
'';
postInstall = ''
# Internal static library.
rm $out/lib/libproto.a
# Install models
cp -a ../models $out/share/Caffe/models
moveToOutput "bin" "$bin"
''
+ lib.optionalString pythonSupport ''
mkdir -p $out/${python.sitePackages}
mv $out/python/caffe $out/${python.sitePackages}
rm -rf $out/python
'';
doInstallCheck = false; # build takes more than 30 min otherwise
installCheckPhase = ''
model=bvlc_reference_caffenet
m_path="$out/share/Caffe/models/$model"
$bin/bin/caffe test \
-model "$m_path/deploy.prototxt" \
-solver "$m_path/solver.prototxt" \
-weights "${test_model_weights}"
'';
meta = with lib; {
description = "Deep learning framework";
longDescription = ''
Caffe is a deep learning framework made with expression, speed, and
modularity in mind. It is developed by the Berkeley Vision and Learning
Center (BVLC) and by community contributors.
'';
homepage = "http://caffe.berkeleyvision.org/";
maintainers = [ ];
broken =
(pythonSupport && (python.isPy310))
|| !(leveldbSupport -> (leveldb != null && snappy != null))
|| !(pythonSupport -> (python != null && numpy != null));
license = licenses.bsd2;
platforms = platforms.linux ++ platforms.darwin;
};
}

View File

@@ -0,0 +1,97 @@
From 38b81bb53304d7a3f6aed36f7b4e77b6efa78338 Mon Sep 17 00:00:00 2001
From: uku <hi@uku.moe>
Date: Wed, 14 May 2025 16:55:15 +0200
Subject: [PATCH] fix linking against glog 0.7.x
---
cmake/Dependencies.cmake | 2 +-
cmake/External/glog.cmake | 4 +--
cmake/Modules/FindGlog.cmake | 48 ------------------------------------
3 files changed, 3 insertions(+), 51 deletions(-)
delete mode 100644 cmake/Modules/FindGlog.cmake
diff --git a/cmake/Dependencies.cmake b/cmake/Dependencies.cmake
index 4a5bac47..88aa123f 100644
--- a/cmake/Dependencies.cmake
+++ b/cmake/Dependencies.cmake
@@ -32,7 +32,7 @@ endif()
# ---[ Google-glog
include("cmake/External/glog.cmake")
list(APPEND Caffe_INCLUDE_DIRS PUBLIC ${GLOG_INCLUDE_DIRS})
-list(APPEND Caffe_LINKER_LIBS PUBLIC ${GLOG_LIBRARIES})
+list(APPEND Caffe_LINKER_LIBS PUBLIC glog::glog)
# ---[ Google-gflags
include("cmake/External/gflags.cmake")
diff --git a/cmake/External/glog.cmake b/cmake/External/glog.cmake
index f9d0549c..43414544 100644
--- a/cmake/External/glog.cmake
+++ b/cmake/External/glog.cmake
@@ -5,8 +5,8 @@ if (NOT __GLOG_INCLUDED)
set(__GLOG_INCLUDED TRUE)
# try the system-wide glog first
- find_package(Glog)
- if (GLOG_FOUND)
+ find_package(glog REQUIRED)
+ if (glog_FOUND)
set(GLOG_EXTERNAL FALSE)
else()
# fetch and build glog from github
diff --git a/cmake/Modules/FindGlog.cmake b/cmake/Modules/FindGlog.cmake
deleted file mode 100644
index 99abbe47..00000000
--- a/cmake/Modules/FindGlog.cmake
+++ /dev/null
@@ -1,48 +0,0 @@
-# - Try to find Glog
-#
-# The following variables are optionally searched for defaults
-# GLOG_ROOT_DIR: Base directory where all GLOG components are found
-#
-# The following are set after configuration is done:
-# GLOG_FOUND
-# GLOG_INCLUDE_DIRS
-# GLOG_LIBRARIES
-# GLOG_LIBRARYRARY_DIRS
-
-include(FindPackageHandleStandardArgs)
-
-set(GLOG_ROOT_DIR "" CACHE PATH "Folder contains Google glog")
-
-if(WIN32)
- find_path(GLOG_INCLUDE_DIR glog/logging.h
- PATHS ${GLOG_ROOT_DIR}/src/windows)
-else()
- find_path(GLOG_INCLUDE_DIR glog/logging.h
- PATHS ${GLOG_ROOT_DIR})
-endif()
-
-if(MSVC)
- find_library(GLOG_LIBRARY_RELEASE libglog_static
- PATHS ${GLOG_ROOT_DIR}
- PATH_SUFFIXES Release)
-
- find_library(GLOG_LIBRARY_DEBUG libglog_static
- PATHS ${GLOG_ROOT_DIR}
- PATH_SUFFIXES Debug)
-
- set(GLOG_LIBRARY optimized ${GLOG_LIBRARY_RELEASE} debug ${GLOG_LIBRARY_DEBUG})
-else()
- find_library(GLOG_LIBRARY glog
- PATHS ${GLOG_ROOT_DIR}
- PATH_SUFFIXES lib lib64)
-endif()
-
-find_package_handle_standard_args(Glog DEFAULT_MSG GLOG_INCLUDE_DIR GLOG_LIBRARY)
-
-if(GLOG_FOUND)
- set(GLOG_INCLUDE_DIRS ${GLOG_INCLUDE_DIR})
- set(GLOG_LIBRARIES ${GLOG_LIBRARY})
- message(STATUS "Found glog (include: ${GLOG_INCLUDE_DIR}, library: ${GLOG_LIBRARY})")
- mark_as_advanced(GLOG_ROOT_DIR GLOG_LIBRARY_RELEASE GLOG_LIBRARY_DEBUG
- GLOG_LIBRARY GLOG_INCLUDE_DIR)
-endif()
--
2.49.0

View File

@@ -0,0 +1,70 @@
commit b14ca23651d390fcae4a929dedc7c33a83453a66
Author: Frederik Rietdijk <fridh@fridh.nl>
Date: Sun Feb 17 08:41:27 2019 +0100
Find boost_pythonXX
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 08f56a33..0a04592a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -99,10 +99,10 @@ add_subdirectory(docs)
add_custom_target(lint COMMAND ${CMAKE_COMMAND} -P ${PROJECT_SOURCE_DIR}/cmake/lint.cmake)
# ---[ pytest target
-if(BUILD_python)
- add_custom_target(pytest COMMAND python${python_version} -m unittest discover -s caffe/test WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/python )
- add_dependencies(pytest pycaffe)
-endif()
+# if(BUILD_python)
+# add_custom_target(pytest COMMAND python${python_version} -m unittest discover -s caffe/test WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/python )
+# add_dependencies(pytest pycaffe)
+# endif()
# ---[ uninstall target
configure_file(
diff --git a/cmake/Dependencies.cmake b/cmake/Dependencies.cmake
index 4a5bac47..be026d43 100644
--- a/cmake/Dependencies.cmake
+++ b/cmake/Dependencies.cmake
@@ -141,37 +141,14 @@ if(BUILD_python)
# use python3
find_package(PythonInterp 3.0)
find_package(PythonLibs 3.0)
- find_package(NumPy 1.7.1)
- # Find the matching boost python implementation
- set(version ${PYTHONLIBS_VERSION_STRING})
-
- STRING( REGEX REPLACE "[^0-9]" "" boost_py_version ${version} )
- find_package(Boost 1.46 COMPONENTS "python-py${boost_py_version}")
- set(Boost_PYTHON_FOUND ${Boost_PYTHON-PY${boost_py_version}_FOUND})
-
- while(NOT "${version}" STREQUAL "" AND NOT Boost_PYTHON_FOUND)
- STRING( REGEX REPLACE "([0-9.]+).[0-9]+" "\\1" version ${version} )
-
- STRING( REGEX REPLACE "[^0-9]" "" boost_py_version ${version} )
- find_package(Boost 1.46 COMPONENTS "python-py${boost_py_version}")
- set(Boost_PYTHON_FOUND ${Boost_PYTHON-PY${boost_py_version}_FOUND})
-
- STRING( REGEX MATCHALL "([0-9.]+).[0-9]+" has_more_version ${version} )
- if("${has_more_version}" STREQUAL "")
- break()
- endif()
- endwhile()
- if(NOT Boost_PYTHON_FOUND)
- find_package(Boost 1.46 COMPONENTS python)
- endif()
else()
# disable Python 3 search
find_package(PythonInterp 2.7)
find_package(PythonLibs 2.7)
- find_package(NumPy 1.7.1)
- find_package(Boost 1.46 COMPONENTS python)
endif()
- if(PYTHONLIBS_FOUND AND NUMPY_FOUND AND Boost_PYTHON_FOUND)
+ find_package(NumPy 1.7.1)
+ find_package(Boost 1.46 REQUIRED COMPONENTS python@major@@minor@)
+ if(PYTHONLIBS_FOUND AND NUMPY_FOUND AND Boost_PYTHON@major@@minor@_FOUND)
set(HAVE_PYTHON TRUE)
if(BUILD_python_layer)
list(APPEND Caffe_DEFINITIONS PRIVATE -DWITH_PYTHON_LAYER)

View File

@@ -0,0 +1,67 @@
From 11e585e52ab92bb9d7a995c5002cb55fbff687b2 Mon Sep 17 00:00:00 2001
From: uku <hi@uku.moe>
Date: Thu, 15 May 2025 11:10:50 +0200
Subject: [PATCH] fix: remove usages of random_shuffle
---
src/caffe/layers/hdf5_data_layer.cpp | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/src/caffe/layers/hdf5_data_layer.cpp b/src/caffe/layers/hdf5_data_layer.cpp
index 00716a92..01213691 100644
--- a/src/caffe/layers/hdf5_data_layer.cpp
+++ b/src/caffe/layers/hdf5_data_layer.cpp
@@ -61,7 +61,9 @@ void HDF5DataLayer<Dtype>::LoadHDF5FileData(const char* filename) {
// Shuffle if needed.
if (this->layer_param_.hdf5_data_param().shuffle()) {
- std::random_shuffle(data_permutation_.begin(), data_permutation_.end());
+ std::random_device rand_device;
+ std::default_random_engine rand_engine(rand_device());
+ std::shuffle(data_permutation_.begin(), data_permutation_.end(), rand_engine);
DLOG(INFO) << "Successfully loaded " << hdf_blobs_[0]->shape(0)
<< " rows (shuffled)";
} else {
@@ -104,7 +106,9 @@ void HDF5DataLayer<Dtype>::LayerSetUp(const vector<Blob<Dtype>*>& bottom,
// Shuffle if needed.
if (this->layer_param_.hdf5_data_param().shuffle()) {
- std::random_shuffle(file_permutation_.begin(), file_permutation_.end());
+ std::random_device rand_device;
+ std::default_random_engine rand_engine(rand_device());
+ std::shuffle(file_permutation_.begin(), file_permutation_.end(), rand_engine);
}
// Load the first HDF5 file and initialize the line counter.
@@ -137,14 +141,17 @@ bool HDF5DataLayer<Dtype>::Skip() {
template<typename Dtype>
void HDF5DataLayer<Dtype>::Next() {
+ std::random_device rand_device;
+ std::default_random_engine rand_engine(rand_device());
if (++current_row_ == hdf_blobs_[0]->shape(0)) {
if (num_files_ > 1) {
++current_file_;
if (current_file_ == num_files_) {
current_file_ = 0;
if (this->layer_param_.hdf5_data_param().shuffle()) {
- std::random_shuffle(file_permutation_.begin(),
- file_permutation_.end());
+ std::shuffle(file_permutation_.begin(),
+ file_permutation_.end(),
+ rand_engine);
}
DLOG(INFO) << "Looping around to first file.";
}
@@ -153,7 +160,7 @@ void HDF5DataLayer<Dtype>::Next() {
}
current_row_ = 0;
if (this->layer_param_.hdf5_data_param().shuffle())
- std::random_shuffle(data_permutation_.begin(), data_permutation_.end());
+ std::shuffle(data_permutation_.begin(), data_permutation_.end(), rand_engine);
}
offset_++;
}
--
2.49.0