From 6ab6ba14f8522794342fcd34779cf8a2fadb11cb Mon Sep 17 00:00:00 2001 From: Sharlatan Hellseher Date: Tue, 8 Jul 2025 12:04:06 +0100 Subject: [PATCH] gnu: Add cianna. * gnu/packages/astronomy.scm (cianna): New variable. Change-Id: If657bc243496a05ecf126f917038b6ccaf56f826 Co-authored-by: Simon Tournier Reviewed-by: Andreas Enge --- gnu/packages/astronomy.scm | 64 +++++++++++++++++++++++++++++++++++++- 1 file changed, 63 insertions(+), 1 deletion(-) diff --git a/gnu/packages/astronomy.scm b/gnu/packages/astronomy.scm index 2fd2c248bf0..55a6f5b0c92 100644 --- a/gnu/packages/astronomy.scm +++ b/gnu/packages/astronomy.scm @@ -11,7 +11,7 @@ ;;; Copyright © 2021 Foo Chuan Wei ;;; Copyright © 2023-2024 Iliya Tikhonenko ;;; Copyright © 2023 Andreas Enge -;;; Copyright © 2023 Simon Tournier +;;; Copyright © 2023, 2025 Simon Tournier ;;; Copyright © 2024-2025 Ricardo Wurmus ;;; Copyright © 2024 Andy Tai ;;; Copyright © 2024-2025 Artyom V. Poptsov @@ -677,6 +677,68 @@ in FITS files.") (sha256 (base32 "098x1l8ijwsjp2ivp3v7pamrmpgwj5xmgb4yppm9w3w044zxr8b6")))))) +(define-public cianna + (package + (name "cianna") + (version "1.0.0") + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/Deyht/CIANNA") + (commit (string-append "V-" version ".0")))) + (file-name (git-file-name name version)) + (sha256 + (base32 "0i7czicyiy9lldsrarsh9lpjm4znx3gnsi1kqqyhiafxjxsji35k")))) + (build-system gnu-build-system) + (arguments + (list + #:phases + #~(modify-phases %standard-phases + (delete 'configure) ; no configure + (delete 'check) ; no tests + (add-after 'unpack 'fix-paths + (lambda* (#:key inputs #:allow-other-keys) + (let* ((blas #$(this-package-input "openblas"))) + (substitute* "compile.cp" + (("/usr/bin/gcc") + #$(cc-for-target)) + (("/opt/OpenBLAS/include/") + (string-append blas "/include/")) + (("/opt/OpenBLAS/lib") + (string-append blas "/lib"))) + (substitute* "src/python_module_setup.py" + (("/opt/OpenBLAS/include") + (string-append blas "/include")) + (("/opt/OpenBLAS/lib") + (string-append blas "/lib")))))) + (replace 'build + (lambda* _ + (invoke "./compile.cp" "BLAS" "OPEN_MP" "LPTHREAD" "PY_INTERF"))) + (replace 'install + (lambda _ + (rename-file "main" "cianna-cpu") + (install-file "cianna-cpu" (string-append #$output "/bin")))) + (add-after 'install 'install-python + (lambda _ + (with-directory-excursion "src" + (invoke "python" "python_module_setup.py" "install" + "--root=/" + (string-append "--prefix=" #$output)))))))) + (native-inputs + (list python-wrapper + python-numpy + python-setuptools)) + (inputs (list openblas)) + (home-page "https://github.com/Deyht/CIANNA") + (synopsis "Deep learning framework for astronomical data analysis") + (description + "This package provides a @acronym{CIANNA, Convolutional Interactive +Artificial Neural Networks by/for Astrophysicists} - a general-purpose deep +learning framework primarily developed and used for astronomical data +analysis.") + (license license:asl2.0))) + (define-public erfa (package (name "erfa")