Skip to content

Commit bf1ecd9

Browse files
qcdloop v2.1.0 (#8)
* updated v2.1.0 * MNT: Add patch to get ppc64le support working - c.f. scarrazza/qcdloop#35 - This patch can be removed in subsequent releases. --------- Co-authored-by: Matthew Feickert <matthew.feickert@cern.ch>
1 parent 3ac432a commit bf1ecd9

2 files changed

Lines changed: 169 additions & 2 deletions

File tree

Lines changed: 163 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,163 @@
1+
From 6e3aac07eb9eb1039e6239284f503a88597219b9 Mon Sep 17 00:00:00 2001
2+
From: Matthew Feickert <matthew.feickert@cern.ch>
3+
Date: Fri, 20 Dec 2024 23:37:54 -0700
4+
Subject: [PATCH] fix: Add back support for ppc64le
5+
6+
* ppc64 little-endian is a supported architecture both on conda-forge and used in
7+
HPC systems. Add back support for it by only disabling libquadmath on aarch64
8+
builds and by checking for the ppc64 in header files.
9+
---
10+
CMakeLists.txt | 4 +++-
11+
src/cache.cc | 2 +-
12+
src/qcdloop/maths.h | 14 +++++++-------
13+
src/qcdloop/types.h | 4 ++--
14+
src/tools.cc | 2 +-
15+
src/types.cc | 2 +-
16+
6 files changed, 15 insertions(+), 13 deletions(-)
17+
18+
diff --git a/CMakeLists.txt b/CMakeLists.txt
19+
index 849d137..5894c76 100644
20+
--- a/CMakeLists.txt
21+
+++ b/CMakeLists.txt
22+
@@ -66,7 +66,9 @@ configure_file(
23+
"${PROJECT_SOURCE_DIR}/src/qcdloop.pc.in"
24+
"${PROJECT_SOURCE_DIR}/src/qcdloop.pc"
25+
)
26+
-IF(${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86_64")
27+
+# Only enable quadmath for non-aarch64 as aarch64 supports float128 and so
28+
+# doesn't have libquadmath
29+
+IF(NOT ${CMAKE_SYSTEM_PROCESSOR} MATCHES "aarch64")
30+
set(QUADMATH_NAMES ${QUADMATH_NAMES} libquadmath.so quadmath)
31+
find_library(QUADMATH_LIBRARY
32+
NAMES ${QUADMATH_NAMES}
33+
diff --git a/src/cache.cc b/src/cache.cc
34+
index 57a80d6..3041681 100644
35+
--- a/src/cache.cc
36+
+++ b/src/cache.cc
37+
@@ -17,7 +17,7 @@ namespace std {
38+
seed ^= hasher(v) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
39+
}
40+
41+
-#if defined(__x86_64__) || defined(__i386__)
42+
+#if defined(__x86_64__) || defined(__i386__) || defined(__PPC64__) || defined(__ppc64__) || defined(_ARCH_PPC64)
43+
template <>
44+
struct hash<ql::qdouble> : public __hash_base<size_t, ql::qdouble>
45+
{
46+
diff --git a/src/qcdloop/maths.h b/src/qcdloop/maths.h
47+
index b52ccf6..5f9a56d 100644
48+
--- a/src/qcdloop/maths.h
49+
+++ b/src/qcdloop/maths.h
50+
@@ -21,7 +21,7 @@ namespace ql
51+
{
52+
// Logarithms
53+
inline double Log(double const& x) { return std::log(x); }
54+
-#if defined(__x86_64__) || defined(__i386__)
55+
+#if defined(__x86_64__) || defined(__i386__) || defined(__PPC64__) || defined(__ppc64__) || defined(_ARCH_PPC64)
56+
inline qdouble Log(qdouble const& x) { return logq(x); }
57+
inline qcomplex Log(qcomplex const& x) { return clogq(x); }
58+
#endif
59+
@@ -33,7 +33,7 @@ namespace ql
60+
61+
// Power
62+
inline double Pow(double const& x, int const& a) { return std::pow(x, a); }
63+
-#if defined(__x86_64__) || defined(__i386__)
64+
+#if defined(__x86_64__) || defined(__i386__) || defined(__PPC64__) || defined(__ppc64__) || defined(_ARCH_PPC64)
65+
inline qdouble Pow(qdouble const& x, int const& a) { return powq(x,a); }
66+
inline qcomplex Pow(qcomplex const& x, int const& a){ return cpowq(x,a); }
67+
#endif
68+
@@ -45,7 +45,7 @@ namespace ql
69+
70+
// Root
71+
inline double Sqrt(double const& x) { return std::sqrt(x); }
72+
-#if defined(__x86_64__) || defined(__i386__)
73+
+#if defined(__x86_64__) || defined(__i386__) || defined(__PPC64__) || defined(__ppc64__) || defined(_ARCH_PPC64)
74+
inline qdouble Sqrt(qdouble const& x) { return sqrtq(x); }
75+
inline qcomplex Sqrt(qcomplex const& x){ return csqrtq(x); }
76+
#endif
77+
@@ -57,7 +57,7 @@ namespace ql
78+
79+
// Absolute value
80+
inline double Abs(double const& x) { return std::abs(x); }
81+
-#if defined(__x86_64__) || defined(__i386__)
82+
+#if defined(__x86_64__) || defined(__i386__) || defined(__PPC64__) || defined(__ppc64__) || defined(_ARCH_PPC64)
83+
inline qdouble Abs(qdouble const& x) { return fabsq(x);}
84+
inline qdouble Abs(qcomplex const& x) { return cabsq(x); }
85+
#endif
86+
@@ -71,7 +71,7 @@ namespace ql
87+
inline double Imag(double const& x) { UNUSED(x); return 0; }
88+
inline qdouble Imag(qdouble const& x) { UNUSED(x); return qdouble(0); }
89+
inline double Imag(complex const& x) { return x.imag(); }
90+
-#if defined(__x86_64__) || defined(__i386__)
91+
+#if defined(__x86_64__) || defined(__i386__) || defined(__PPC64__) || defined(__ppc64__) || defined(_ARCH_PPC64)
92+
inline qdouble Imag(qcomplex const& x){ return cimagq(x);}
93+
#endif
94+
#if defined(__aarch64__)
95+
@@ -81,7 +81,7 @@ namespace ql
96+
inline double Real(double const& x) { return x; }
97+
inline qdouble Real(qdouble const& x) { return x; }
98+
inline double Real(complex const& x) { return x.real(); }
99+
-#if defined(__x86_64__) || defined(__i386__)
100+
+#if defined(__x86_64__) || defined(__i386__) || defined(__PPC64__) || defined(__ppc64__) || defined(_ARCH_PPC64)
101+
inline qdouble Real(qcomplex const& x) { return crealq(x); }
102+
#endif
103+
#if defined(__aarch64__)
104+
@@ -89,7 +89,7 @@ namespace ql
105+
#endif
106+
107+
inline complex Conjg(complex const& x) { return std::conj(x); }
108+
-#if defined(__x86_64__) || defined(__i386__)
109+
+#if defined(__x86_64__) || defined(__i386__) || defined(__PPC64__) || defined(__ppc64__) || defined(_ARCH_PPC64)
110+
inline qcomplex Conjg(qcomplex const& x){ return conjq(x); }
111+
#endif
112+
#if defined(__aarch64__)
113+
diff --git a/src/qcdloop/types.h b/src/qcdloop/types.h
114+
index 0294bcd..63be78a 100644
115+
--- a/src/qcdloop/types.h
116+
+++ b/src/qcdloop/types.h
117+
@@ -7,7 +7,7 @@
118+
119+
#pragma once
120+
121+
-#if defined(__x86_64__) || defined(__i386__)
122+
+#if defined(__x86_64__) || defined(__i386__) || defined(__PPC64__) || defined(__ppc64__) || defined(_ARCH_PPC64)
123+
extern "C" { // for gcc4.7 compatibility
124+
#include <quadmath.h>
125+
}
126+
@@ -49,7 +49,7 @@ namespace ql
127+
namespace std
128+
{
129+
130+
-#if defined(__x86_64__) || defined(__i386__)
131+
+#if defined(__x86_64__) || defined(__i386__) || defined(__PPC64__) || defined(__ppc64__) || defined(_ARCH_PPC64)
132+
//! implementation of operator<< for qdouble
133+
ostream& operator<<(std::ostream& out, ql::qdouble f);
134+
#endif
135+
diff --git a/src/tools.cc b/src/tools.cc
136+
index bb24b76..7587d8d 100644
137+
--- a/src/tools.cc
138+
+++ b/src/tools.cc
139+
@@ -20,7 +20,7 @@ namespace ql {
140+
template<typename TOutput, typename TMass, typename TScale>
141+
Tools<TOutput,TMass,TScale>::Tools():
142+
_qlonshellcutoff(is_same<TScale,double>::value ? 1e-10 : 1e-20q),
143+
-#if defined(__x86_64__) || defined(__i386__)
144+
+#if defined(__x86_64__) || defined(__i386__) || defined(__PPC64__) || defined(__ppc64__) || defined(_ARCH_PPC64)
145+
_pi(is_same<TScale,double>::value ? M_PI : M_PIq),
146+
#endif
147+
#if defined(__aarch64__)
148+
diff --git a/src/types.cc b/src/types.cc
149+
index 19ac110..6bfb298 100644
150+
--- a/src/types.cc
151+
+++ b/src/types.cc
152+
@@ -9,7 +9,7 @@
153+
154+
namespace std
155+
{
156+
-#if defined(__x86_64__) || defined(__i386__)
157+
+#if defined(__x86_64__) || defined(__i386__) || defined(__PPC64__) || defined(__ppc64__) || defined(_ARCH_PPC64)
158+
ostream& operator<<(std::ostream& out, ql::qdouble f)
159+
{
160+
char buf[200];
161+
--
162+
2.47.1
163+

recipe/meta.yaml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
11
{% set name = "qcdloop" %}
2-
{% set version = "2.0.11" %}
2+
{% set version = "2.1.0" %}
33

44
package:
55
name: {{ name }}
66
version: {{ version }}
77

88
source:
99
url: https://github.com/scarrazza/{{ name }}/archive/{{ version }}.tar.gz
10-
sha256: a6274a4f552209c5e8c41d265af52214ac72a235a25d3b771f969deb2f15788a
10+
sha256: 75ac2d00231714210859d39c4beebce14f183707afe47f4550f33ef9f348b3c1
1111
folder: source
12+
patches:
13+
# Remove in releases after v2.1.0
14+
# c.f. https://github.com/scarrazza/qcdloop/pull/35
15+
- add-back-support-for-ppc64le.patch
1216

1317
build:
1418
# FIXME: clang does not yet support quadmath, so macOS builds are broken

0 commit comments

Comments
 (0)