GNU bug report logs - #65553
[PATCH 0/6] gnu: Add arrayfire.

Previous Next

Package: guix-patches;

Reported by: Adam Faiz <adam.faiz <at> disroot.org>

Date: Sat, 26 Aug 2023 18:48:02 UTC

Severity: normal

Tags: patch

To reply to this bug, email your comments to 65553 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#65553; Package guix-patches. (Sat, 26 Aug 2023 18:48:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Adam Faiz <adam.faiz <at> disroot.org>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Sat, 26 Aug 2023 18:48:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Adam Faiz <adam.faiz <at> disroot.org>
To: guix-patches <at> gnu.org
Subject: [PATCH 0/6] gnu: Add arrayfire.
Date: Sun, 27 Aug 2023 02:46:48 +0800
From 0d1c25484158655344cbfbdc1e3e503be23654d1 Mon Sep 17 00:00:00 2001
Message-ID: <cover.1693075221.git.adam.faiz <at> disroot.org>
From: AwesomeAdam54321 <adam.faiz <at> disroot.org>
Date: Sun, 27 Aug 2023 02:40:21 +0800
Subject: [PATCH 0/6] gnu: Add arrayfire.

This is how far I made it when it comes to packaging ArrayFire.
I don't know if ArrayFire builds, since on my computer all the RAM(4GB) is used up by the linker at some point.
If anyone knows how to reduce memory usage when linking, please let me know.

AwesomeAdam54321 (6):
  gnu: Add arrayfire-glad.
  gnu: Add span-lite.
  gnu: Add arrayfire-threads.
  gnu: Add arrayfire-forge.
  gnu: Add arrayfire-docs.
  gnu: Add arrayfire.

 gnu/local.mk                                  |   1 +
 gnu/packages/cpp.scm                          |  62 ++++++++
 gnu/packages/gl.scm                           |  42 +++++
 gnu/packages/machine-learning.scm             |  98 ++++++++++++
 ...arrayfire-glad-add-packaging-support.patch | 145 ++++++++++++++++++
 gnu/packages/statistics.scm                   |  51 ++++++
 6 files changed, 399 insertions(+)
 create mode 100644 gnu/packages/patches/arrayfire-glad-add-packaging-support.patch


base-commit: d17eea747277643811134f9a33b534e58160688f
-- 
2.41.0




Information forwarded to guix-patches <at> gnu.org:
bug#65553; Package guix-patches. (Sat, 26 Aug 2023 18:51:01 GMT) Full text and rfc822 format available.

Message #8 received at 65553 <at> debbugs.gnu.org (full text, mbox):

From: Adam Faiz <adam.faiz <at> disroot.org>
To: 65553 <at> debbugs.gnu.org
Subject: [PATCH 1/6] gnu: Add arrayfire-glad.
Date: Sun, 27 Aug 2023 02:50:37 +0800
From 668b7978a7dd2e6daece5209621601575eaad900 Mon Sep 17 00:00:00 2001
Message-ID: <668b7978a7dd2e6daece5209621601575eaad900.1693075221.git.adam.faiz <at> disroot.org>
In-Reply-To: <cover.1693075221.git.adam.faiz <at> disroot.org>
References: <cover.1693075221.git.adam.faiz <at> disroot.org>
From: AwesomeAdam54321 <adam.faiz <at> disroot.org>
Date: Sun, 27 Aug 2023 01:59:48 +0800
Subject: [PATCH 1/6] gnu: Add arrayfire-glad.

* gnu/packages/patches/arrayfire-glad-add-packaging-support.patch: New file.
* gnu/local.mk (dist_patch_DATA): Register it here.
* gnu/packages/gl.scm (arrayfire-glad): New variable.
---
 gnu/local.mk                                  |   1 +
 gnu/packages/gl.scm                           |  42 +++++
 ...arrayfire-glad-add-packaging-support.patch | 145 ++++++++++++++++++
 3 files changed, 188 insertions(+)
 create mode 100644 gnu/packages/patches/arrayfire-glad-add-packaging-support.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index adda02d410..3c1f7665ff 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -902,6 +902,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/akonadi-not-relocatable.patch		\
   %D%/packages/patches/akonadi-timestamps.patch		\
   %D%/packages/patches/allegro-mesa-18.2.5-and-later.patch	\
+  %D%/packages/patches/arrayfire-glad-add-packaging-support.patch		\
   %D%/packages/patches/ibus-anthy-fix-tests.patch		\
   %D%/packages/patches/ibus-table-paths.patch			\
   %D%/packages/patches/anki-mpv-args.patch			\
diff --git a/gnu/packages/gl.scm b/gnu/packages/gl.scm
index b53b42a9ba..7476aba06f 100644
--- a/gnu/packages/gl.scm
+++ b/gnu/packages/gl.scm
@@ -108,6 +108,48 @@ (define-public glu
 as ASCII text.")
     (license (license:x11-style "http://directory.fsf.org/wiki/License:SGIFreeBv2"))))
 
+(define-public arrayfire-glad
+  (let ((commit "ef8c5508e72456b714820c98e034d9a55b970650")
+        (revision "0"))
+    (package
+      (name "arrayfire-glad")
+      (version (git-version "0" revision commit))
+      (source
+       (origin
+         (method git-fetch)
+         (uri (git-reference
+               (url "https://github.com/arrayfire/glad.git")
+               (commit commit)))
+         (sha256
+          (base32 "0yln2mrymhb6ni6gb1vc0vrzbrkzmsxk7wyvbgqlv16bnmrmxmdv"))
+         (patches (search-patches "arrayfire-glad-add-packaging-support.patch"))
+         (modules '((guix build utils)))
+         (snippet
+          #~(begin
+              (substitute* "CMakeLists.txt"
+                (("OBJECT") "SHARED")
+                (("af_glad_obj_lib") "glad")
+                (("target_include_directories.*)\n" all)
+                 (string-append all "\n\n"
+                                "configure_file(glad.pc.in glad.pc @ONLY)\n"
+                                "install(DIRECTORY include/\n"
+                                "DESTINATION include/)\n"
+                                "\n\n"
+                                "install(TARGETS glad\n"
+                                "DESTINATION lib/)\n"
+                                "install(FILES ${CMAKE_CURRENT_BINARY_DIR}/glad.pc\n"
+                                "DESTINATION lib/pkgconfig/)\n"
+                                "install(FILES gladConfig.cmake\n"
+                                "DESTINATION lib/cmake/glad/)\n")))))
+         (file-name (git-file-name name version))))
+      (build-system cmake-build-system)
+      (arguments
+       (list #:tests? #f)) ; no tests
+      (home-page "https://github.com/arrayfire/glad")
+      (synopsis "OpenGL(3.3) Loader Library")
+      (description "OpenGL(3.3) Loader Library, a dependency of ArrayFire.")
+      (license license:bsd-3))))
+
 (define-public freeglut
   (package
     (name "freeglut")
diff --git a/gnu/packages/patches/arrayfire-glad-add-packaging-support.patch b/gnu/packages/patches/arrayfire-glad-add-packaging-support.patch
new file mode 100644
index 0000000000..a7591eee7b
--- /dev/null
+++ b/gnu/packages/patches/arrayfire-glad-add-packaging-support.patch
@@ -0,0 +1,145 @@
+From ceaa23fd1834ad56fe5f74d544b650be9a55360b Mon Sep 17 00:00:00 2001
+From: AwesomeAdam54321 <adam.faiz <at> disroot.org>
+Date: Sat, 26 Aug 2023 16:38:13 +0800
+Subject: [PATCH] glad: Add package configuration files.
+
+* glad.pc.in: Add pkg-config file.
+* gladConfig.cmake: Add CMake package file for detection by external packages.
+---
+ glad.pc.in          |  11 +++++
+ gladConfig.cmake | 104 +++++++++++++++++++++++++++++++++++++++++++++++
+ 2 files changed, 115 insertions(+)
+ create mode 100644 glad.pc
+ create mode 100644 gladConfig.cmake
+
+diff --git a/glad.pc.in b/glad.pc.in
+new file mode 100644
+index 0000000..5c29fcd
+--- /dev/null
++++ b/glad.pc.in
+@@ -0,0 +1,11 @@
++prefix=@CMAKE_INSTALL_PREFIX@   # this defines a variable
++exec_prefix=${prefix}      # defining another variable with a substitution
++libdir=${exec_prefix}/lib
++includedir=${prefix}/include
++
++Name: glad
++Description: OpenGL(3.3) Loader Library
++Version: 0
++URL: https://github.com/arrayfire/glad
++Libs: -L${libdir} -lglad
++Cflags: -I${includedir}/glad
+\ No newline at end of file
+diff --git a/gladConfig.cmake b/gladConfig.cmake
+new file mode 100644
+index 0000000..1213d3e
+--- /dev/null
++++ b/gladConfig.cmake
+@@ -0,0 +1,104 @@
++# Finds the glad libraries
++#
++# Sets the following variables:
++#          glad_FOUND
++#          glad_INCLUDE_DIR
++#          glad_DYNAMIC_LIBRARY
++#          glad_STATIC_LIBRARY
++#
++# Usage:
++# find_package(glad)
++# if (glad_FOUND)
++#    target_link_libraries(mylib PRIVATE glad::glad)
++# endif (glad_FOUND)
++#
++# OR if you want to link against the static library:
++#
++# find_package(glad)
++# if (glad_FOUND)
++#    target_link_libraries(mylib PRIVATE glad::glad_STATIC)
++# endif (glad_FOUND)
++#
++# NOTE: You do not need to include the glad include directories since they
++# will be included as part of the target_link_libraries command
++
++set(PX ${CMAKE_STATIC_LIBRARY_PREFIX})
++set(SX ${CMAKE_STATIC_LIBRARY_SUFFIX})
++
++# use pkg-config to get the directories and then use these values
++# in the find_path() and find_library() calls
++if (NOT WIN32)
++    find_package(PkgConfig)
++    pkg_check_modules(gladPkg REQUIRED glad)
++endif (NOT WIN32)
++
++find_path(glad_INCLUDE_DIR
++    NAMES glad.h
++    PATHS
++        /usr/include
++        /usr/local/include
++        /sw/include
++        /opt/local/include
++    HINTS
++        ${gladPkg_INCLUDE_DIRS} # Generated by pkg-config
++    )
++
++find_library(glad_DYNAMIC_LIBRARY
++    NAMES glad fontconfig ${gladPkg_LIBRARY}
++    PATHS
++        /usr/local
++        /usr/X11
++        /usr
++        /sw
++        /opt/local
++        /usr/lib/x86_64-linux-gnu
++    HINTS
++        ${gladPkg_LIBRARY_DIRS} # Generated by pkg-config
++    PATH_SUFFIXES
++        lib64
++        lib
++    )
++
++find_library(glad_STATIC_LIBRARY
++    NAMES ${PX}fontconfig${SX} ${PX}glad${SX} ${PX}${gladPkg_LIBRARY}${SX}
++    PATHS
++        /usr/local
++        /usr/X11
++        /usr
++        /sw
++        /opt/local
++        /usr/lib/x86_64-linux-gnu
++    HINTS
++        ${gladPkg_LIBRARY_DIRS} # Generated by pkg-config
++    PATH_SUFFIXES
++        lib64
++        lib
++    )
++
++mark_as_advanced(
++    glad_INCLUDE_DIR
++    glad_DYNAMIC_LIBRARY
++    glad_STATIC_LIBRARY
++    )
++
++include(FindPackageHandleStandardArgs)
++
++find_package_handle_standard_args(glad
++    REQUIRED_VARS glad_DYNAMIC_LIBRARY glad_INCLUDE_DIR
++    )
++
++if (glad_FOUND AND NOT TARGET glad::glad)
++    add_library(glad::glad UNKNOWN IMPORTED)
++    set_target_properties(glad::glad PROPERTIES
++        IMPORTED_LINK_INTERFACE_LANGUAGE "C"
++        IMPORTED_LOCATION ${glad_DYNAMIC_LIBRARY}
++        INTERFACE_INCLUDE_DIRECTORIES ${glad_INCLUDE_DIR})
++
++    if (glad_STATIC_LIBRARY)
++        add_library(glad::glad_STATIC UNKNOWN IMPORTED)
++        set_target_properties(glad::glad_STATIC PROPERTIES
++            IMPORTED_LINK_INTERFACE_LANGUAGE "C"
++            IMPORTED_LOCATION "${glad_STATIC_LIBRARY}"
++            INTERFACE_INCLUDE_DIRECTORIES "${glad_INCLUDE_DIR}")
++    endif (glad_STATIC_LIBRARY)
++endif ()
+-- 
+2.41.0
+
-- 
2.41.0




Information forwarded to guix-patches <at> gnu.org:
bug#65553; Package guix-patches. (Sat, 26 Aug 2023 18:52:02 GMT) Full text and rfc822 format available.

Message #11 received at 65553 <at> debbugs.gnu.org (full text, mbox):

From: Adam Faiz <adam.faiz <at> disroot.org>
To: 65553 <at> debbugs.gnu.org
Subject: [PATCH 2/6] gnu: Add span-lite.
Date: Sun, 27 Aug 2023 02:51:25 +0800
From e865289a2ee999420d353b28d584dbe294ac19b1 Mon Sep 17 00:00:00 2001
Message-ID: <e865289a2ee999420d353b28d584dbe294ac19b1.1693075221.git.adam.faiz <at> disroot.org>
In-Reply-To: <cover.1693075221.git.adam.faiz <at> disroot.org>
References: <cover.1693075221.git.adam.faiz <at> disroot.org>
From: AwesomeAdam54321 <adam.faiz <at> disroot.org>
Date: Sun, 27 Aug 2023 02:05:30 +0800
Subject: [PATCH 2/6] gnu: Add span-lite.

* gnu/packages/cpp.scm (span-lite): New variable.
---
 gnu/packages/cpp.scm | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm
index 41f24b0998..6ab3710000 100644
--- a/gnu/packages/cpp.scm
+++ b/gnu/packages/cpp.scm
@@ -759,6 +759,28 @@ (define-public concurrentqueue
 concurrent queue for C++11.")
     (license license:bsd-2)))
 
+(define-public span-lite
+  (package
+    (name "span-lite")
+    (version "0.10.3")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/martinmoene/span-lite")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "0xs7gq84d05h607076c2fvxzx8yb4zy3gmh432379af1yb435yjr"))))
+    (build-system cmake-build-system)
+    (synopsis "C++20-like span header for C++98 and later")
+    (description
+     "Span lite is a single-file header-only library to provide a bounds-safe
+view for sequences of objects.
+  The library provides a C++20-like span for use with C++98 and later.")
+    (home-page "https://github.com/martinmoene/span-lite")
+    (license license:boost1.0)))
+
 (define-public spscqueue
   (package
     (name "spscqueue")
-- 
2.41.0




Information forwarded to guix-patches <at> gnu.org:
bug#65553; Package guix-patches. (Sat, 26 Aug 2023 18:53:02 GMT) Full text and rfc822 format available.

Message #14 received at 65553 <at> debbugs.gnu.org (full text, mbox):

From: Adam Faiz <adam.faiz <at> disroot.org>
To: 65553 <at> debbugs.gnu.org
Subject: [PATCH 3/6] gnu: Add arrayfire-threads.
Date: Sun, 27 Aug 2023 02:52:39 +0800
From 8eb098f8c795f0bfdc036fc53c94de6f7c29eeb1 Mon Sep 17 00:00:00 2001
Message-ID: <8eb098f8c795f0bfdc036fc53c94de6f7c29eeb1.1693075221.git.adam.faiz <at> disroot.org>
In-Reply-To: <cover.1693075221.git.adam.faiz <at> disroot.org>
References: <cover.1693075221.git.adam.faiz <at> disroot.org>
From: AwesomeAdam54321 <adam.faiz <at> disroot.org>
Date: Sun, 27 Aug 2023 02:06:31 +0800
Subject: [PATCH 3/6] gnu: Add arrayfire-threads.

* gnu/packages/cpp.scm (arrayfire-threads): New variable.
---
 gnu/packages/cpp.scm | 40 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)

diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm
index 6ab3710000..64147167c1 100644
--- a/gnu/packages/cpp.scm
+++ b/gnu/packages/cpp.scm
@@ -1554,6 +1554,46 @@ (define-public lager
 event loops it also provides lenses and cursors.")
      (license license:expat))))
 
+(define-public arrayfire-threads
+  (let ((commit "4d4a4f0384d1ac2f25b2c4fc1d57b9e25f4d6818")
+        (revision "0"))
+  (package
+    (name "arrayfire-threads")
+    (version (git-version "0.0.0" revision commit))
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/arrayfire/threads")
+             (commit commit)))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "0zipmh6rlk9nzczqp0bj9jjbqvjyk1rxnxz5rqpx83h91bvi7axa"))
+       (modules '((guix build utils)))
+       (snippet
+        #~(begin
+            (substitute* "Makefile"
+              (("g\\+\\+-4.9") "g++")
+              (("-o test" all)
+               (string-append all "\n\n"
+                              "install:\n\t"
+                              "mkdir -p $(DESTDIR)$(PREFIX)/include\n\t"
+                              "cp -r include $(DESTDIR)$(PREFIX)")))))))
+    (build-system gnu-build-system)
+    (arguments
+     (list #:make-flags
+           #~(list (string-append "DESTDIR=" #$output))
+           #:phases
+           #~(modify-phases %standard-phases
+               (delete 'configure) ; no configure
+               (delete 'build) ; building the headers fail to compile
+               (delete 'check)))) ; test.cpp is compiled in the `all` target
+    (synopsis "Threads headers for ArrayFire")
+    (description
+     "This package provides threads headers for ArrayFire.")
+    (home-page "https://github.com/arrayfire/threads")
+    (license license:bsd-3))))
+
 (define-public atomic-queue
   (package
     (name "atomic-queue")
-- 
2.41.0




Information forwarded to guix-patches <at> gnu.org:
bug#65553; Package guix-patches. (Sat, 26 Aug 2023 18:54:02 GMT) Full text and rfc822 format available.

Message #17 received at 65553 <at> debbugs.gnu.org (full text, mbox):

From: Adam Faiz <adam.faiz <at> disroot.org>
To: 65553 <at> debbugs.gnu.org
Subject: [PATCH 4/6] gnu: Add arrayfire-forge.
Date: Sun, 27 Aug 2023 02:53:47 +0800
From 57c398fa56f343ef3767f3be33a47c33a510b758 Mon Sep 17 00:00:00 2001
Message-ID: <57c398fa56f343ef3767f3be33a47c33a510b758.1693075221.git.adam.faiz <at> disroot.org>
In-Reply-To: <cover.1693075221.git.adam.faiz <at> disroot.org>
References: <cover.1693075221.git.adam.faiz <at> disroot.org>
From: AwesomeAdam54321 <adam.faiz <at> disroot.org>
Date: Sun, 27 Aug 2023 02:09:00 +0800
Subject: [PATCH 4/6] gnu: Add arrayfire-forge.

* gnu/packages/statistics.scm (arrayfire-forge): New variable.
---
 gnu/packages/statistics.scm | 51 +++++++++++++++++++++++++++++++++++++
 1 file changed, 51 insertions(+)

diff --git a/gnu/packages/statistics.scm b/gnu/packages/statistics.scm
index 5abc62d760..7681af717b 100644
--- a/gnu/packages/statistics.scm
+++ b/gnu/packages/statistics.scm
@@ -43,6 +43,7 @@ (define-module (gnu packages statistics)
   #:use-module (guix git-download)
   #:use-module (guix utils)
   #:use-module (guix build-system ant)
+  #:use-module (guix build-system cmake)
   #:use-module (guix build-system emacs)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system r)
@@ -54,16 +55,19 @@ (define-module (gnu packages statistics)
   #:use-module (gnu packages algebra)
   #:use-module (gnu packages autotools)
   #:use-module (gnu packages bash)
+  #:use-module (gnu packages boost)
   #:use-module (gnu packages check)
   #:use-module (gnu packages compression)
   #:use-module (gnu packages cran)
   #:use-module (gnu packages curl)
+  #:use-module (gnu packages documentation)
   #:use-module (gnu packages emacs)
   #:use-module (gnu packages emacs-xyz)
   #:use-module (gnu packages fontutils)
   #:use-module (gnu packages gcc)
   #:use-module (gnu packages gtk)
   #:use-module (gnu packages gettext)
+  #:use-module (gnu packages gl)
   #:use-module (gnu packages glib)
   #:use-module (gnu packages haskell-xyz)
   #:use-module (gnu packages icu4c)
@@ -77,6 +81,7 @@ (define-module (gnu packages statistics)
   #:use-module (gnu packages multiprecision)
   #:use-module (gnu packages ncurses)
   #:use-module (gnu packages ocaml)
+  #:use-module (gnu packages opencl)
   #:use-module (gnu packages pcre)
   #:use-module (gnu packages perl)
   #:use-module (gnu packages pkg-config)
@@ -6821,6 +6826,52 @@ (define-public emacs-poly-r
 files, including Rmarkdown files.")
     (license license:gpl3+)))
 
+(define-public arrayfire-forge
+  (package
+    (name "arrayfire-forge")
+    (version "1.0.8")
+    (source
+      (origin
+        (method git-fetch)
+        (uri (git-reference
+               (url "https://github.com/arrayfire/forge.git")
+               (commit (string-append "v" version))))
+        (sha256
+         (base32 "19bqqq56bvpi9dyn7i3p86ccs9v45zy5a74njacjn7l0rb0l09lm"))
+        (modules '((guix build utils)))
+        (snippet
+         #~(begin
+             (substitute* "CMakeLists.txt"
+               (("include\\(ForgeConfigureDepsVars\\)") ""))
+             (substitute* "examples/CMakeLists.txt"
+               (("include.build_cl2hpp.") ""))))
+        (file-name (git-file-name name version))))
+    (build-system cmake-build-system)
+    (native-inputs
+     (list doxygen
+           pkg-config
+           python-breathe
+           python-sphinx
+           python-recommonmark))
+    (inputs
+     (list arrayfire-glad
+           boost
+           fontconfig
+           freeimage
+           freetype
+           glfw
+           glm
+           opencl-clhpp))
+    (arguments
+     (list #:tests? #f)) ; no tests
+    (home-page "https://arrayfire.com/")
+    (synopsis "OpenGL visualiser")
+    (description "Forge is an OpenGL interop library that can be used
+with ArrayFire or any other application using the OpenCL compute backend.
+  The goal of Forge is to provide OpenGL visualizations
+for C/C++ applications that use OpenCL.")
+    (license license:bsd-3)))
+
 (define-public readstat
   (package
     (name "readstat")
-- 
2.41.0




Information forwarded to guix-patches <at> gnu.org:
bug#65553; Package guix-patches. (Sat, 26 Aug 2023 18:56:03 GMT) Full text and rfc822 format available.

Message #20 received at 65553 <at> debbugs.gnu.org (full text, mbox):

From: Adam Faiz <adam.faiz <at> disroot.org>
To: 65553 <at> debbugs.gnu.org
Subject: [PATCH 5/6] gnu: Add arrayfire-docs.
Date: Sun, 27 Aug 2023 02:55:03 +0800
From 73a6d3371cf1020a2d270b0c67187711d09be9c4 Mon Sep 17 00:00:00 2001
Message-ID: <73a6d3371cf1020a2d270b0c67187711d09be9c4.1693075221.git.adam.faiz <at> disroot.org>
In-Reply-To: <cover.1693075221.git.adam.faiz <at> disroot.org>
References: <cover.1693075221.git.adam.faiz <at> disroot.org>
From: AwesomeAdam54321 <adam.faiz <at> disroot.org>
Date: Sun, 27 Aug 2023 02:10:07 +0800
Subject: [PATCH 5/6] gnu: Add arrayfire-docs.

* gnu/packages/machine-learning.scm (arrayfire-docs): New variable.
---
 gnu/packages/machine-learning.scm | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/gnu/packages/machine-learning.scm b/gnu/packages/machine-learning.scm
index c32180615b..6251ea9206 100644
--- a/gnu/packages/machine-learning.scm
+++ b/gnu/packages/machine-learning.scm
@@ -45,6 +45,7 @@ (define-module (gnu packages machine-learning)
   #:use-module (guix download)
   #:use-module (guix svn-download)
   #:use-module (guix build-system cmake)
+  #:use-module (guix build-system copy)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system ocaml)
   #:use-module (guix build-system pyproject)
@@ -3101,6 +3102,32 @@ (define-public tensorflow-lite
 devices.")
     (license license:asl2.0)))
 
+(define-public arrayfire-docs
+  (let ((commit "cd08d749611b324012555ad6f23fd76c5465bd6c")
+        (revision "0"))
+  (package
+    (name "arrayfire-docs")
+    (version (package-version arrayfire))
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/arrayfire/assets")
+             (commit commit)))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "0s1il38y65z19mcrhvqvkm5ljv6v55ilw1bxwcsmhgzmzjla32xz"))))
+    (build-system copy-build-system)
+    (arguments
+     (list
+      #:install-plan
+      #~'(("./" "./"))))
+    (synopsis "ArrayFire documentation")
+    (description
+     "This package contains the files used for ArrayFire's documentation.")
+    (home-page "https://arrayfire.com/")
+    (license license:cc0))))
+
 (define-public dmlc-core
   (package
     (name "dmlc-core")
-- 
2.41.0




Information forwarded to guix-patches <at> gnu.org:
bug#65553; Package guix-patches. (Sat, 26 Aug 2023 18:57:02 GMT) Full text and rfc822 format available.

Message #23 received at 65553 <at> debbugs.gnu.org (full text, mbox):

From: Adam Faiz <adam.faiz <at> disroot.org>
To: 65553 <at> debbugs.gnu.org
Subject: [PATCH 6/6] gnu: Add arrayfire.
Date: Sun, 27 Aug 2023 02:56:34 +0800
From 0d1c25484158655344cbfbdc1e3e503be23654d1 Mon Sep 17 00:00:00 2001
Message-ID: <0d1c25484158655344cbfbdc1e3e503be23654d1.1693075221.git.adam.faiz <at> disroot.org>
In-Reply-To: <cover.1693075221.git.adam.faiz <at> disroot.org>
References: <cover.1693075221.git.adam.faiz <at> disroot.org>
From: AwesomeAdam54321 <adam.faiz <at> disroot.org>
Date: Sun, 27 Aug 2023 02:12:03 +0800
Subject: [PATCH 6/6] gnu: Add arrayfire.

* gnu/packages/machine-learning.scm (arrayfire): New variable.
---
 gnu/packages/machine-learning.scm | 71 +++++++++++++++++++++++++++++++
 1 file changed, 71 insertions(+)

diff --git a/gnu/packages/machine-learning.scm b/gnu/packages/machine-learning.scm
index 6251ea9206..e2ca22821b 100644
--- a/gnu/packages/machine-learning.scm
+++ b/gnu/packages/machine-learning.scm
@@ -69,6 +69,8 @@ (define-module (gnu packages machine-learning)
   #:use-module (gnu packages cran)
   #:use-module (gnu packages databases)
   #:use-module (gnu packages dejagnu)
+  #:use-module (gnu packages documentation)
+  #:use-module (gnu packages fontutils)
   #:use-module (gnu packages freedesktop)
   #:use-module (gnu packages gcc)
   #:use-module (gnu packages gettext)
@@ -85,6 +87,7 @@ (define-module (gnu packages machine-learning)
   #:use-module (gnu packages libffi)
   #:use-module (gnu packages linux)
   #:use-module (gnu packages llvm)
+  #:use-module (gnu packages logging)
   #:use-module (gnu packages maths)
   #:use-module (gnu packages mpi)
   #:use-module (gnu packages ninja)
@@ -93,6 +96,7 @@ (define-module (gnu packages machine-learning)
   #:use-module (gnu packages parallel)
   #:use-module (gnu packages perl)
   #:use-module (gnu packages pkg-config)
+  #:use-module (gnu packages pretty-print)
   #:use-module (gnu packages protobuf)
   #:use-module (gnu packages pulseaudio)
   #:use-module (gnu packages python)
@@ -3102,6 +3106,73 @@ (define-public tensorflow-lite
 devices.")
     (license license:asl2.0)))
 
+(define-public arrayfire
+  (package
+    (name "arrayfire")
+    (version "3.8.3")
+    (source
+      (origin
+        (method git-fetch)
+        (uri (git-reference
+               (url "https://github.com/arrayfire/arrayfire.git")
+               (commit (string-append "v" version))))
+        (sha256
+         (base32 "1fvd0jvg49inhqx0mcqrfsfnqvc3n0pgnym5gina5svgh293n68a"))
+        (modules '((guix build utils)))
+        (snippet
+         #~(begin
+             (substitute* "CMakeLists.txt"
+               (("add_subdirectory\\(\\$.*\\)") "")
+               (("NO_CMAKE_PACKAGE_REGISTRY") "")
+               (("include\\(AFconfigure_deps_vars\\)")
+                (string-append "macro(af_dep_check_and_populate dep_prefix)\n"
+                               "endmacro()"))
+               (("....assets_prefix._SOURCE_DIR.")
+                "$ENV{ARRAYFIRE_DOCS_PREFIX}"))
+             (substitute* "test/CMakeLists.txt"
+               (("include\\(download_sparse_datasets\\)") ""))
+             (substitute* "CMakeModules/FindFFTW.cmake"
+               (("FFTWF_LIBRARY\\)") ")"))
+             (substitute* "src/backend/cpu/CMakeLists.txt"
+               (("....threads_prefix._.*hpp") ""))))
+        (file-name (git-file-name name version))))
+    (build-system cmake-build-system)
+    (native-inputs
+     (list arrayfire-docs
+           doxygen
+           googletest
+           pkg-config))
+    (inputs
+     (list arrayfire-forge
+           arrayfire-glad
+           arrayfire-threads
+           boost
+           fftw
+           fmt
+           fontconfig
+           freeimage
+           glfw
+           lapack
+           libomp
+           openblas
+           span-lite
+           spdlog))
+    (arguments
+     (list #:configure-flags
+           #~(list "-DCMAKE_EXE_LINKER_FLAGS=-Wl,--no-keep-memory")
+           #:phases
+           #~(modify-phases %standard-phases
+               (add-before 'configure 'set-envs
+                 (lambda _
+                   (setenv "ARRAYFIRE_DOCS_PREFIX"
+                           #$(this-package-native-input "arrayfire-docs")))))))
+    (home-page "https://arrayfire.com/")
+    (synopsis "General purpose tensor library")
+    (description "ArrayFire is a general-purpose tensor library that simplifies
+the process of software development for the parallel architectures found in
+CPUs, GPUs, and other hardware acceleration devices.")
+    (license license:bsd-3)))
+
 (define-public arrayfire-docs
   (let ((commit "cd08d749611b324012555ad6f23fd76c5465bd6c")
         (revision "0"))
-- 
2.41.0




Information forwarded to guix-patches <at> gnu.org:
bug#65553; Package guix-patches. (Sat, 26 Aug 2023 19:20:01 GMT) Full text and rfc822 format available.

Message #26 received at 65553 <at> debbugs.gnu.org (full text, mbox):

From: Saku Laesvuori <saku <at> laesvuori.fi>
To: Adam Faiz <adam.faiz <at> disroot.org>
Cc: 65553 <at> debbugs.gnu.org
Subject: Re: [bug#65553] [PATCH 0/6] gnu: Add arrayfire.
Date: Sat, 26 Aug 2023 22:18:56 +0300
[Message part 1 (text/plain, inline)]
> I don't know if ArrayFire builds, since on my computer all the
> RAM(4GB) is used up by the linker at some point.
>
> If anyone knows how to reduce memory usage when linking, please let me know.

I have normally solve this by just adding a huge swapfile, but if
someone knows how to actually reduce the ram usage by the linker that
would be interesting to hear.
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#65553; Package guix-patches. (Mon, 28 Aug 2023 06:31:02 GMT) Full text and rfc822 format available.

Message #29 received at 65553 <at> debbugs.gnu.org (full text, mbox):

From: Adam Faiz <adam.faiz <at> disroot.org>
To: Saku Laesvuori <saku <at> laesvuori.fi>
Cc: 65553 <at> debbugs.gnu.org
Subject: Re: [bug#65553] [PATCH 0/6] gnu: Add arrayfire.
Date: Mon, 28 Aug 2023 14:30:21 +0800
On 8/27/23 03:18, Saku Laesvuori wrote:
> I have normally solve this by just adding a huge swapfile, but if
> someone knows how to actually reduce the ram usage by the linker that
> would be interesting to hear.
Thanks, using a swapfile worked for me.
The --no-keep-memory option reduces RAM usage for the linker, it was actually the compiler that was using up all my RAM.

To my understanding, the only effective way to reduce RAM usage of the compiler is to not have many running at the same time,
i.e. to reduce the number of parallel jobs by the build system.
The ggc-min-heapsize and ggc-min-expand GCC options could also be used instead, but I don't know if it's faster than just using swap.

Now I got ArrayFire to build, I just need to ensure its tests pass.




This bug report was last modified 250 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.