Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 15 Mar 2023 10:18:44 GMT
From:      Yuri Victorovich <yuri@FreeBSD.org>
To:        ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org
Subject:   git: c15247cb4f64 - main - misc/flashlight: New port: Standalone C++ library for machine learning
Message-ID:  <202303151018.32FAIiXJ018538@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by yuri:

URL: https://cgit.FreeBSD.org/ports/commit/?id=c15247cb4f6446b22b6c122dffba9f598c8f1b90

commit c15247cb4f6446b22b6c122dffba9f598c8f1b90
Author:     Yuri Victorovich <yuri@FreeBSD.org>
AuthorDate: 2023-03-15 10:17:16 +0000
Commit:     Yuri Victorovich <yuri@FreeBSD.org>
CommitDate: 2023-03-15 10:18:40 +0000

    misc/flashlight: New port: Standalone C++ library for machine learning
---
 misc/Makefile                                      |   1 +
 misc/flashlight/Makefile                           |  31 +++++
 misc/flashlight/distinfo                           |   3 +
 ...patch-flashlight_fl_dataset_FileBlobDataset.cpp |  22 ++++
 misc/flashlight/pkg-descr                          |  11 ++
 misc/flashlight/pkg-plist                          | 132 +++++++++++++++++++++
 6 files changed, 200 insertions(+)

diff --git a/misc/Makefile b/misc/Makefile
index abb7ac05afd9..21d1f1cc12cd 100644
--- a/misc/Makefile
+++ b/misc/Makefile
@@ -107,6 +107,7 @@
     SUBDIR += findutils
     SUBDIR += firestring
     SUBDIR += flag
+    SUBDIR += flashlight
     SUBDIR += fortune-mod-bible
     SUBDIR += fortune-mod-bofh
     SUBDIR += fortune-mod-epictetus
diff --git a/misc/flashlight/Makefile b/misc/flashlight/Makefile
new file mode 100644
index 000000000000..307c867c7b0e
--- /dev/null
+++ b/misc/flashlight/Makefile
@@ -0,0 +1,31 @@
+PORTNAME=	flashlight
+DISTVERSIONPREFIX=	v
+DISTVERSION=	0.4.0-16
+DISTVERSIONSUFFIX=	-gafcd364e
+CATEGORIES=	misc # machine-learning
+
+MAINTAINER=	yuri@FreeBSD.org
+COMMENT=	Standalone C++ library for machine learning
+WWW=		https://github.com/flashlight/flashlight
+
+LICENSE=	MIT
+LICENSE_FILE=	${WRKSRC}/LICENSE
+
+BUILD_DEPENDS=	cereal>0:devel/cereal
+LIB_DEPENDS=	libdnnl.so:math/onednn252
+
+USES=		cmake:testing compiler:c++17-lang localbase pkgconfig
+USE_GITHUB=	yes
+USE_LDCONFIG=	yes
+
+CMAKE_OFF=	FL_USE_ARRAYFIRE \
+		FL_BUILD_TESTS FL_BUILD_EXAMPLES
+CMAKE_OFF+=	FL_BUILD_DISTRIBUTED # need to add MPI options
+CMAKE_ON=	BUILD_SHARED_LIBS \
+		FL_USE_CPU
+CMAKE_ON+=	FL_USE_ONEDNN # needs to have oneDNN enabled because it needs a working tensor backend
+
+post-patch: # workaround for https://github.com/flashlight/flashlight/issues/1086
+	@${RM} ${WRKSRC}/cmake/Findcereal.cmake
+
+.include <bsd.port.mk>
diff --git a/misc/flashlight/distinfo b/misc/flashlight/distinfo
new file mode 100644
index 000000000000..07eb73bba565
--- /dev/null
+++ b/misc/flashlight/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1678872027
+SHA256 (flashlight-flashlight-v0.4.0-16-gafcd364e_GH0.tar.gz) = fef0eaf57a1ac58255be5d428265cb829b976ca5580215ba81406cb8808a743b
+SIZE (flashlight-flashlight-v0.4.0-16-gafcd364e_GH0.tar.gz) = 1966617
diff --git a/misc/flashlight/files/patch-flashlight_fl_dataset_FileBlobDataset.cpp b/misc/flashlight/files/patch-flashlight_fl_dataset_FileBlobDataset.cpp
new file mode 100644
index 000000000000..d3fabb44d987
--- /dev/null
+++ b/misc/flashlight/files/patch-flashlight_fl_dataset_FileBlobDataset.cpp
@@ -0,0 +1,22 @@
+- workaround for https://github.com/flashlight/flashlight/issues/1087
+
+--- flashlight/fl/dataset/FileBlobDataset.cpp.orig	2023-03-15 07:10:45 UTC
++++ flashlight/fl/dataset/FileBlobDataset.cpp
+@@ -72,7 +72,7 @@ int64_t FileBlobDataset::writeData(
+   auto fs = getStream();
+   fs->seekp(offset, std::ios_base::beg);
+   fs->write(data, size);
+-  return fs->tellp() - offset;
++  return int64_t(fs->tellp()) - offset;
+ }
+ 
+ int64_t FileBlobDataset::readData(int64_t offset, char* data, int64_t size)
+@@ -80,7 +80,7 @@ int64_t FileBlobDataset::readData(int64_t offset, char
+   auto fs = getStream();
+   fs->seekg(offset, std::ios_base::beg);
+   fs->read(data, size);
+-  return fs->tellg() - offset;
++  return int64_t(fs->tellg()) - offset;
+ }
+ 
+ void FileBlobDataset::flushData() {
diff --git a/misc/flashlight/pkg-descr b/misc/flashlight/pkg-descr
new file mode 100644
index 000000000000..f7430a539c3d
--- /dev/null
+++ b/misc/flashlight/pkg-descr
@@ -0,0 +1,11 @@
+Flashlight is a fast, flexible machine learning library written entirely in C++
+from the Facebook AI Research and the creators of Torch, TensorFlow, Eigen and
+Deep Speech.
+
+Its core features include:
+* Total internal modifiability including internal APIs for tensor computation.
+* A small footprint, with the core clocking in at under 10 MB and 20k lines
+  of C++.
+* High-performance defaults featuring just-in-time kernel compilation with
+  modern C++ via the ArrayFire tensor library.
+* An emphasis on efficiency and scale.
diff --git a/misc/flashlight/pkg-plist b/misc/flashlight/pkg-plist
new file mode 100644
index 000000000000..467534659cae
--- /dev/null
+++ b/misc/flashlight/pkg-plist
@@ -0,0 +1,132 @@
+include/flashlight/fl/autograd/Functions.h
+include/flashlight/fl/autograd/Utils.h
+include/flashlight/fl/autograd/Variable.h
+include/flashlight/fl/autograd/autograd.h
+include/flashlight/fl/autograd/tensor/AutogradExtension.h
+include/flashlight/fl/autograd/tensor/AutogradExtensionBackends.h
+include/flashlight/fl/autograd/tensor/AutogradOps.h
+include/flashlight/fl/common/Defines.h
+include/flashlight/fl/common/DevicePtr.h
+include/flashlight/fl/common/DynamicBenchmark.h
+include/flashlight/fl/common/Filesystem.h
+include/flashlight/fl/common/Histogram.h
+include/flashlight/fl/common/Logging.h
+include/flashlight/fl/common/Plugin.h
+include/flashlight/fl/common/Serialization-inl.h
+include/flashlight/fl/common/Serialization.h
+include/flashlight/fl/common/Timer.h
+include/flashlight/fl/common/Types.h
+include/flashlight/fl/common/Utils.h
+include/flashlight/fl/common/common.h
+include/flashlight/fl/common/threadpool/ThreadPool.h
+include/flashlight/fl/contrib/contrib.h
+include/flashlight/fl/contrib/modules/AdaptiveEmbedding.h
+include/flashlight/fl/contrib/modules/AsymmetricConv1D.h
+include/flashlight/fl/contrib/modules/Conformer.h
+include/flashlight/fl/contrib/modules/PositionEmbedding.h
+include/flashlight/fl/contrib/modules/RawWavSpecAugment.h
+include/flashlight/fl/contrib/modules/Residual.h
+include/flashlight/fl/contrib/modules/SinusoidalPositionEmbedding.h
+include/flashlight/fl/contrib/modules/SpecAugment.h
+include/flashlight/fl/contrib/modules/TDSBlock.h
+include/flashlight/fl/contrib/modules/Transformer.h
+include/flashlight/fl/contrib/modules/modules.h
+include/flashlight/fl/dataset/BatchDataset.h
+include/flashlight/fl/dataset/BlobDataset.h
+include/flashlight/fl/dataset/ConcatDataset.h
+include/flashlight/fl/dataset/Dataset.h
+include/flashlight/fl/dataset/DatasetIterator.h
+include/flashlight/fl/dataset/FileBlobDataset.h
+include/flashlight/fl/dataset/MemoryBlobDataset.h
+include/flashlight/fl/dataset/MergeDataset.h
+include/flashlight/fl/dataset/PrefetchDataset.h
+include/flashlight/fl/dataset/ResampleDataset.h
+include/flashlight/fl/dataset/ShuffleDataset.h
+include/flashlight/fl/dataset/TensorDataset.h
+include/flashlight/fl/dataset/TransformDataset.h
+include/flashlight/fl/dataset/Utils.h
+include/flashlight/fl/dataset/datasets.h
+include/flashlight/fl/distributed/DistributedApi.h
+include/flashlight/fl/distributed/FileStore.h
+include/flashlight/fl/distributed/LRUCache.h
+include/flashlight/fl/distributed/distributed.h
+include/flashlight/fl/distributed/reducers/CoalescingReducer.h
+include/flashlight/fl/distributed/reducers/InlineReducer.h
+include/flashlight/fl/distributed/reducers/Reducer.h
+include/flashlight/fl/distributed/reducers/reducers.h
+include/flashlight/fl/flashlight.h
+include/flashlight/fl/meter/AverageValueMeter.h
+include/flashlight/fl/meter/CountMeter.h
+include/flashlight/fl/meter/EditDistanceMeter.h
+include/flashlight/fl/meter/FrameErrorMeter.h
+include/flashlight/fl/meter/MSEMeter.h
+include/flashlight/fl/meter/TimeMeter.h
+include/flashlight/fl/meter/TopKMeter.h
+include/flashlight/fl/meter/meters.h
+include/flashlight/fl/nn/DistributedUtils.h
+include/flashlight/fl/nn/Init.h
+include/flashlight/fl/nn/Utils.h
+include/flashlight/fl/nn/modules/Activations.h
+include/flashlight/fl/nn/modules/AdaptiveSoftMax.h
+include/flashlight/fl/nn/modules/BatchNorm.h
+include/flashlight/fl/nn/modules/Container.h
+include/flashlight/fl/nn/modules/Conv2D.h
+include/flashlight/fl/nn/modules/Dropout.h
+include/flashlight/fl/nn/modules/Embedding.h
+include/flashlight/fl/nn/modules/Identity.h
+include/flashlight/fl/nn/modules/LayerNorm.h
+include/flashlight/fl/nn/modules/Linear.h
+include/flashlight/fl/nn/modules/Loss.h
+include/flashlight/fl/nn/modules/Module.h
+include/flashlight/fl/nn/modules/Normalize.h
+include/flashlight/fl/nn/modules/Padding.h
+include/flashlight/fl/nn/modules/Pool2D.h
+include/flashlight/fl/nn/modules/PrecisionCast.h
+include/flashlight/fl/nn/modules/RNN.h
+include/flashlight/fl/nn/modules/Reorder.h
+include/flashlight/fl/nn/modules/Transform.h
+include/flashlight/fl/nn/modules/View.h
+include/flashlight/fl/nn/modules/WeightNorm.h
+include/flashlight/fl/nn/modules/modules.h
+include/flashlight/fl/nn/nn.h
+include/flashlight/fl/optim/AMSgradOptimizer.h
+include/flashlight/fl/optim/AdadeltaOptimizer.h
+include/flashlight/fl/optim/AdagradOptimizer.h
+include/flashlight/fl/optim/AdamOptimizer.h
+include/flashlight/fl/optim/NAGOptimizer.h
+include/flashlight/fl/optim/NovogradOptimizer.h
+include/flashlight/fl/optim/Optimizers.h
+include/flashlight/fl/optim/RMSPropOptimizer.h
+include/flashlight/fl/optim/SGDOptimizer.h
+include/flashlight/fl/optim/Utils.h
+include/flashlight/fl/optim/optim.h
+include/flashlight/fl/runtime/CUDADevice.h
+include/flashlight/fl/runtime/CUDAStream.h
+include/flashlight/fl/runtime/CUDAUtils.h
+include/flashlight/fl/runtime/Device.h
+include/flashlight/fl/runtime/DeviceManager.h
+include/flashlight/fl/runtime/DeviceType.h
+include/flashlight/fl/runtime/Stream.h
+include/flashlight/fl/runtime/SynchronousStream.h
+include/flashlight/fl/runtime/runtime.h
+include/flashlight/fl/tensor/Compute.h
+include/flashlight/fl/tensor/DefaultTensorType.h
+include/flashlight/fl/tensor/Index.h
+include/flashlight/fl/tensor/Init.h
+include/flashlight/fl/tensor/Profile.h
+include/flashlight/fl/tensor/Random.h
+include/flashlight/fl/tensor/Shape.h
+include/flashlight/fl/tensor/TensorAdapter.h
+include/flashlight/fl/tensor/TensorBackend.h
+include/flashlight/fl/tensor/TensorBase.h
+include/flashlight/fl/tensor/TensorExtension.h
+include/flashlight/fl/tensor/Types.h
+include/flashlight/fl/tensor/tensor.h
+lib/libflashlight.so
+lib/libflashlight.so.0
+lib/libflashlight.so.0.4.0
+%%DATADIR%%/cmake/FindFilesystem.cmake
+%%DATADIR%%/cmake/flashlightConfig.cmake
+%%DATADIR%%/cmake/flashlightConfigVersion.cmake
+%%DATADIR%%/cmake/flashlightTargets-%%CMAKE_BUILD_TYPE%%.cmake
+%%DATADIR%%/cmake/flashlightTargets.cmake



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202303151018.32FAIiXJ018538>