View | Details | Raw Unified | Return to bug 237844 | Differences between
and this patch

Collapse All | Expand All

(-)math/mprime/Makefile (-2 / +1 lines)
Lines 2-9 Link Here
2
# $FreeBSD$
2
# $FreeBSD$
3
3
4
PORTNAME=	mprime
4
PORTNAME=	mprime
5
PORTVERSION=	29.4b7
5
PORTVERSION=	29.8b3
6
PORTREVISION=	1
7
CATEGORIES=	math benchmarks net
6
CATEGORIES=	math benchmarks net
8
MASTER_SITES=	http://www.mersenne.org/ftp_root/gimps/ \
7
MASTER_SITES=	http://www.mersenne.org/ftp_root/gimps/ \
9
		ftp://mersenne.org/gimps/
8
		ftp://mersenne.org/gimps/
(-)math/mprime/distinfo (-3 / +3 lines)
Lines 1-3 Link Here
1
TIMESTAMP = 1542398806
1
TIMESTAMP = 1557620197
2
SHA256 (p95v294b7.source.zip) = 15682e9587af2b86647de9786f97dc8c5d7a4a679a0440f7d1d1936a48c5aa45
2
SHA256 (p95v298b3.source.zip) = dac67702e45689e058519164222b6a1f0b32d9e7c88049f7c59f9699174105f0
3
SIZE (p95v294b7.source.zip) = 47931498
3
SIZE (p95v298b3.source.zip) = 51553788
(-)math/mprime/files/patch-commonc.c (-17 / +18 lines)
Lines 1-18 Link Here
1
--- commonc.c.orig	2016-09-14 03:33:00 UTC
1
--- commonc.c.orig	2019-04-11 17:46:50.000000000 +0300
2
+++ commonc.c
2
+++ commonc.c	2019-05-12 03:52:33.503858000 +0300
3
@@ -3247,13 +3247,13 @@ void tempFileName (
3
@@ -386,6 +386,8 @@
4
 /* From now on, we will use k and c to generate the filename.  To reduce */
4
 	CPU_L2_CACHE_INCLUSIVE = -1;
5
 /* upgrading problems, old save file names are renamed. */
5
 	CPU_L3_CACHE_INCLUSIVE = -1;
6
 	CPU_L4_CACHE_INCLUSIVE = -1;
7
+
8
+#if HWLOC_API_VERSION >= 0x00020000
9
 	for (depth = 0; depth < hwloc_topology_get_depth (hwloc_topology); depth++) {
10
 		for (i = 0; i < (int) hwloc_get_nbobjs_by_depth (hwloc_topology, depth); i++) {
11
 			hwloc_obj_t obj;
12
@@ -423,6 +425,7 @@
13
 			}
14
 		}
15
 	}
16
+#endif
6
 
17
 
7
-	if (w->k != 1.0 || abs(w->c) != 1) {
18
 /* Overwrite the cache info calculated via CPUID as hwloc's info is more detailed and I believe more reliable. */
8
+	if (w->k != 1.0 || labs(w->c) != 1) {
19
 /* We are transitioning away from using the cache size global variables computed by the CPUID code. */
9
 		char	v258_filename[32];
10
 		strcpy (v258_filename, buf);
11
 		buf[1] = 0;
12
 		if (w->k != 1.0) sprintf (buf+strlen(buf), "%g", fmod (w->k, 1000000.0));
13
 		sprintf (buf+strlen(buf), "_%ld", p);
14
-		if (abs(w->c) != 1) sprintf (buf+strlen(buf), "_%d", abs(w->c) % 1000);
15
+		if (labs(w->c) != 1) sprintf (buf+strlen(buf), "_%ld", labs(w->c) % 1000);
16
 		rename (v258_filename, buf);
17
 		if (buf[0] == 'p') {
18
 			v258_filename[0] = buf[0] = 'q';
(-)math/mprime/files/patch-ecm.c (-11 lines)
Lines 1-11 Link Here
1
--- ecm.c.orig	2016-05-02 04:44:52 UTC
2
+++ ecm.c
3
@@ -1068,7 +1068,7 @@ int setN (
4
         }
5
 
6
 	if (IniGetInt (INI_FILE, "PhiExtensions", 0) &&
7
-	    w->k == 1.0 && abs(w->c) == 1 && (w->n%3) == 0) {		/*=== this input means Phi(3,-b^(n/3)) ===*/
8
+	    w->k == 1.0 && labs(w->c) == 1 && (w->n%3) == 0) {		/*=== this input means Phi(3,-b^(n/3)) ===*/
9
 		giant	tmp = allocgiant ((bits >> 5) + 5);
10
 		if (tmp == NULL) return (OutOfMemory (thread_num));
11
 		ultog (w->b, tmp);
(-)math/mprime/files/patch-gwnum_gwnum.c (-126 lines)
Lines 1-126 Link Here
1
--- gwnum/gwnum.c.orig	2016-10-30 14:22:26 UTC
2
+++ gwnum/gwnum.c
3
@@ -865,17 +865,17 @@
4
 	log2k = log2 (k);
5
 	logbk = logb (k);
6
 	log2b = log2 (b);
7
-	log2c = log2 (abs (c));
8
+	log2c = log2 (labs (c));
9
 	log2maxmulbyconst = log2 (gwdata->maxmulbyconst);
10
 
11
 /* First, see what FFT length we would get if we emulate the k*b^n+c modulo */
12
-/* with a zero padded FFT.  If k is 1 and abs (c) is 1 then we can skip this */
13
+/* with a zero padded FFT.  If k is 1 and labs (c) is 1 then we can skip this */
14
 /* loop as we're sure to find an IBDWT that will do the job. Also skip if called from */
15
 /* gwmap_fftlen_to_max_exponent (n = 0) or we are QAing IBDWT FFTs (qa_pick_nth_fft >= 1000) */
16
 
17
 again:	zpad_jmptab = NULL;
18
 	generic_jmptab = NULL;
19
-	if (! gwdata->force_general_mod && (k > 1.0 || (n > 0 && n < 500) || abs (c) > 1) && gwdata->qa_pick_nth_fft < 1000) {
20
+	if (! gwdata->force_general_mod && (k > 1.0 || (n > 0 && n < 500) || labs (c) > 1) && gwdata->qa_pick_nth_fft < 1000) {
21
 
22
 /* Use the proper 2^N-1 jmptable */
23
 
24
@@ -1915,13 +1915,13 @@
25
 
26
 	if (c == 0)
27
 		gcd = 0;
28
-	else if (k == 1.0 || abs (c) == 1)
29
+	else if (k == 1.0 || labs (c) == 1)
30
 		gcd = 1;
31
 	else {
32
 		stackgiant(kg,2);
33
 		stackgiant(cg,2);
34
 		dbltog (k, kg);
35
-		itog (abs (c), cg);
36
+		itog (labs (c), cg);
37
 		gcdg (kg, cg);
38
 		gcd = cg->n[0];
39
 	}
40
@@ -1935,7 +1935,7 @@
41
 
42
 	if (gcd == 1 &&
43
 	    k * gwdata->maxmulbyconst <= MAX_ZEROPAD_K &&
44
-	    abs (c) * gwdata->maxmulbyconst <= MAX_ZEROPAD_C &&
45
+	    labs (c) * gwdata->maxmulbyconst <= MAX_ZEROPAD_C &&
46
 	    log2(b) * (double) n >= 350.0 &&
47
 	    (b == 2 || (gwdata->cpu_flags & (CPU_AVX | CPU_SSE2))) &&
48
 	    !gwdata->force_general_mod) {
49
@@ -2555,12 +2555,12 @@
50
 	gwdata->NUM_B_PER_SMALL_WORD = (unsigned long) gwdata->avg_num_b_per_word;
51
 
52
 /* Set a flag if this is a rational FFT.  That is, an FFT where all the */
53
-/* weighting factors are 1.0.  This happens when abs(c) is 1 and every */
54
+/* weighting factors are 1.0.  This happens when labs(c) is 1 and every */
55
 /* FFT word has the same number of b's.  The assembly code can make some */
56
 /* obvious optimizations when all the FFT weights are one. */
57
 
58
 	gwdata->RATIONAL_FFT = asm_data->RATIONAL_FFT =
59
-		((double) gwdata->NUM_B_PER_SMALL_WORD == gwdata->avg_num_b_per_word) && (abs (c) == 1);
60
+		((double) gwdata->NUM_B_PER_SMALL_WORD == gwdata->avg_num_b_per_word) && (labs (c) == 1);
61
 
62
 /* Remember the maximum number of bits per word that this FFT length */
63
 /* supports.  We this in gwnear_fft_limit.  Note that zero padded FFTs */
64
@@ -3814,7 +3814,7 @@
65
 		if (gwdata->ZERO_PADDED_FFT ||
66
 		    3.0 * gwdata->NUM_B_PER_SMALL_WORD * log2 (b) >
67
 				2.0 * ((gwdata->NUM_B_PER_SMALL_WORD + 1) * log2 (b) - 1) +
68
-				0.6 * log2 (gwdata->FFTLEN) + log2 (k) + 1.7 * log2 (abs (c)))
69
+				0.6 * log2 (gwdata->FFTLEN) + log2 (k) + 1.7 * log2 (labs (c)))
70
 			asm_data->SPREAD_CARRY_OVER_EXTRA_WORDS = FALSE;
71
 		else
72
 			asm_data->SPREAD_CARRY_OVER_EXTRA_WORDS = TRUE;
73
@@ -6409,7 +6409,7 @@
74
 		sprintf (buf, "%.0f", k + c);
75
 	else if (k != 1.0)
76
 		sprintf (buf, "%.0f*%lu^%lu%c%lu", k, b, n,
77
-			 c < 0 ? '-' : '+', (unsigned long) abs (c));
78
+			 c < 0 ? '-' : '+', (unsigned long) labs (c));
79
 	else if (b == 2 && c == -1)
80
 		sprintf (buf, "M%lu", n);
81
 	else {
82
@@ -6419,7 +6419,7 @@
83
 			sprintf (buf, "F%lu", cnt);
84
 		else
85
 			sprintf (buf, "%lu^%lu%c%lu", b, n,
86
-				 c < 0 ? '-' : '+', (unsigned long) abs (c));
87
+				 c < 0 ? '-' : '+', (unsigned long) labs (c));
88
 	}
89
 }
90
 
91
@@ -6504,7 +6504,7 @@
92
 		weighted_bits_per_output_word =
93
 			2.0 * ((b_per_input_word + 1.0) * log2b - 1.0) +
94
 			0.6 * log2 (gwdata->FFTLEN) +
95
-			log2 (gwdata->k) + 1.7 * log2 (abs (gwdata->c));
96
+			log2 (gwdata->k) + 1.7 * log2 (labs (gwdata->c));
97
 		if (gwdata->k == 1.0 && gwdata->n % gwdata->FFTLEN == 0)
98
 			weighted_bits_per_output_word -= ((log2b <= 4.0) ? log2b : 1.4 * log2b);
99
 		else if (num_big_words == 1 && gwdata->k > 1.0)
100
@@ -6911,7 +6911,7 @@
101
 {
102
 	unsigned long word, b_in_word;
103
 
104
-	ASSERTG (gwdata->k == 1.0 || abs (gwdata->c) == 1);
105
+	ASSERTG (gwdata->k == 1.0 || labs (gwdata->c) == 1);
106
 
107
 /* In a zero-padded FFT, the value is added into ZPAD0 */
108
 
109
@@ -7177,7 +7177,7 @@
110
 /* Small numbers can also be optimized for many moduli by zeroing all the */
111
 /* FFT data using memset and then setting only the affected FFT elements. */
112
 
113
-	else if (a->sign == 1 && (gwdata->k == 1.0 || abs (gwdata->c) == 1)) {
114
+	else if (a->sign == 1 && (gwdata->k == 1.0 || labs (gwdata->c) == 1)) {
115
 		uint32_t low_addin;
116
 		int	i;
117
 
118
@@ -7802,7 +7802,7 @@
119
 /* Handle negative input values */
120
 
121
 	    neg ^= (g->sign < 0);
122
-	    g->sign = abs (g->sign);
123
+	    g->sign = labs (g->sign);
124
 
125
 /* If number is bigger than the modulus, do a mod using shifts and adds */
126
 /* This will get us close to the right answer. */
(-)math/mprime/files/patch-gwnum_gwutil.c (-11 lines)
Lines 1-11 Link Here
1
--- gwnum/gwutil.c.orig	2016-09-07 01:25:20 UTC
2
+++ gwnum/gwutil.c
3
@@ -17,7 +17,7 @@
4
 #include <malloc.h>
5
 #include <memory.h>
6
 #endif
7
-#ifdef __APPLE__
8
+#if defined (__APPLE__) || defined (__FreeBSD__)
9
 #include <memory.h>
10
 #endif
11
 #include "gwcommon.h"
(-)math/mprime/files/patch-gwnum_makebsd64 (-21 lines)
Lines 1-21 Link Here
1
--- gwnum/makebsd64.orig	2017-04-25 17:00:32.000000000 +0300
2
+++ gwnum/makebsd64	2019-02-16 02:43:48.159335000 +0300
3
@@ -1,13 +1,13 @@
4
 # Makefile for FreeBSD 10.0 64-bit gwnum library
5
 #
6
 
7
-CC = cc
8
-CFLAGS = -I.. -I../sqlite-amalgamation-3180000 -DX86_64 -O2
9
+#CC = cc
10
+CFLAGS += -I.. -I../sqlite-amalgamation-3180000 -DX86_64
11
 
12
-CPP = cc
13
-CPPFLAGS = -I.. -I../qd -DX86_64 -O2
14
+CPP = ${CXX}
15
+CPPFLAGS = ${CXXFLAGS} -I.. -I../qd -DX86_64
16
 
17
-AR = ar
18
+#AR = ar
19
 
20
 LINUXOBJS = cpuid.o gwnum.o gwtables.o gwthread.o gwini.o gwbench.o gwutil.o gwdbldbl.o giants.o ecmstag1.o
21
 
(-)math/mprime/files/patch-gwnum_makemsys (-21 lines)
Lines 1-21 Link Here
1
--- gwnum/makemsys.orig	2016-10-30 18:42:08 UTC
2
+++ gwnum/makemsys
3
@@ -1,13 +1,13 @@
4
 # Makefile for Mingw/msys gwnum library
5
 #
6
 
7
-CC = gcc
8
-CFLAGS = -I.. -I../sqlite-amalgamation-3180000 -O2 -march=i486 -malign-double
9
+#CC = cc
10
+CFLAGS += -I.. -I../sqlite-amalgamation-3180000 -march=i486
11
 
12
-CPP = g++
13
-CPPFLAGS = -I.. -I../qd -O2 -march=i486 -malign-double
14
+CPP = ${CXX}
15
+CPPFLAGS = ${CXXFLAGS} -I.. -I../qd -march=i486
16
 
17
-AR = ar
18
+#AR = ar
19
 
20
 LINUXOBJS = cpuid.o gwnum.o gwtables.o gwthread.o gwini.o gwbench.o gwutil.o gwdbldbl.o giants.o ecmstag1.o
21
 
(-)math/mprime/files/patch-gwtest.c (-80 lines)
Lines 1-80 Link Here
1
--- gwtest.c.orig	2015-12-14 04:55:34 UTC
2
+++ gwtest.c
3
@@ -306,7 +306,7 @@ void test_it_all (
4
 			gwstartnextfft (&gwdata, (i & 3) == 2);
5
 
6
 			/* Test gwsetaddin without and with POSTFFT set */
7
-			if ((i == 45 || i == 46) && abs (c) == 1)
8
+			if ((i == 45 || i == 46) && labs (c) == 1)
9
 				gwsetaddin (&gwdata, -31);
10
 
11
 			/* Test several different ways to square a number */
12
@@ -326,7 +326,7 @@ void test_it_all (
13
 			/* Remember maximum difference */
14
 			diff = fabs (gwsuminp (&gwdata, x) - gwsumout (&gwdata, x));
15
 			if (diff > maxdiff) maxdiff = diff;
16
-			if ((i == 45 || i == 46) && abs (c) == 1)
17
+			if ((i == 45 || i == 46) && labs (c) == 1)
18
 				gwsetaddin (&gwdata, 0);
19
 		}
20
 		if (gwdata.MAXDIFF < 1e50)
21
@@ -347,7 +347,7 @@ void test_it_all (
22
 /* Test square and mul carefully */
23
 
24
 		gwfree (&gwdata, x3); gwfree (&gwdata, x4);
25
-		if (abs (c) == 1) gwsetaddin (&gwdata, -42);
26
+		if (labs (c) == 1) gwsetaddin (&gwdata, -42);
27
 		gwsquare_carefully (&gwdata, x);
28
 		diff = fabs (gwsuminp (&gwdata, x) - gwsumout (&gwdata, x));
29
 		if (diff > maxdiff) maxdiff = diff;
30
@@ -355,7 +355,7 @@ void test_it_all (
31
 		gwfree (&gwdata, gwdata.GW_RANDOM); gwdata.GW_RANDOM = NULL;
32
 		diff = fabs (gwsuminp (&gwdata, x) - gwsumout (&gwdata, x));
33
 		if (diff > maxdiff) maxdiff = diff;
34
-		if (abs (c) == 1) gwsetaddin (&gwdata, 0);
35
+		if (labs (c) == 1) gwsetaddin (&gwdata, 0);
36
 
37
 /* Test gwaddquick, gwsubquick */
38
 
39
@@ -499,7 +499,7 @@ void test_it (
40
 		gwstartnextfft (gwdata, (i & 3) == 2);
41
 
42
 		/* Test gwsetaddin without and with POSTFFT set */
43
-		if ((i == 45 || i == 46) && abs (gwdata->c) == 1)
44
+		if ((i == 45 || i == 46) && labs (gwdata->c) == 1)
45
 			gwsetaddin (gwdata, -31);
46
 
47
 		/* Test several different ways to square a number */
48
@@ -522,7 +522,7 @@ void test_it (
49
 
50
 		/* Square number (and do add-in) using giants code */
51
 		squaregi (&gwdata->gdata, g);
52
-		if ((i == 45 || i == 46) && abs (gwdata->c) == 1) {
53
+		if ((i == 45 || i == 46) && labs (gwdata->c) == 1) {
54
 			iaddg (-31, g);
55
 			gwsetaddin (gwdata, 0);
56
 		}
57
@@ -600,12 +600,12 @@ void test_it (
58
 /* Test square and mul carefully */
59
 
60
 	gwfree (gwdata, x3); gwfree (gwdata, x4);
61
-	if (abs (gwdata->c) == 1) gwsetaddin (gwdata, -42);
62
+	if (labs (gwdata->c) == 1) gwsetaddin (gwdata, -42);
63
 	gwsquare_carefully (gwdata, x);
64
 	diff = fabs (gwsuminp (gwdata, x) - gwsumout (gwdata, x));
65
 	if (diff > maxdiff) maxdiff = diff;
66
 	squaregi (&gwdata->gdata, g);
67
-	if (abs (gwdata->c) == 1) iaddg (-42, g);
68
+	if (labs (gwdata->c) == 1) iaddg (-42, g);
69
 	specialmodg (gwdata, g);
70
 	if (CHECK_OFTEN) compare (thread_num, gwdata, x, g);
71
 	gwmul_carefully (gwdata, x, x);
72
@@ -613,7 +613,7 @@ void test_it (
73
 	diff = fabs (gwsuminp (gwdata, x) - gwsumout (gwdata, x));
74
 	if (diff > maxdiff) maxdiff = diff;
75
 	squaregi (&gwdata->gdata, g);
76
-	if (abs (gwdata->c) == 1) { iaddg (-42, g); gwsetaddin (gwdata, 0); }
77
+	if (labs (gwdata->c) == 1) { iaddg (-42, g); gwsetaddin (gwdata, 0); }
78
 	specialmodg (gwdata, g);
79
 	if (CHECK_OFTEN) compare (thread_num, gwdata, x, g);
80
 
(-)math/mprime/files/patch-linux64_makebsd (-29 lines)
Lines 1-29 Link Here
1
--- linux64/makebsd.orig	2016-10-30 18:42:16 UTC
2
+++ linux64/makebsd
3
@@ -1,19 +1,19 @@
4
 # Makefile for FreeBSD 10.0 64-bit mprime
5
 #
6
-# Install the curl package.  This will be installed to /usr/local by default.
7
+# Install the curl package.  This will be installed to %%LOCALBASE%% by default.
8
 #
9
 # Hwloc can be downloaded from https://www.open-mpi.org/projects/hwloc/
10
 # Configure hwloc with --enable-static --disable-shared --disable-pci --disable-cuda --disable-gl
11
 #
12
 
13
-CC = cc
14
-CFLAGS = -I.. -I../gwnum -I/usr/local/include -DX86_64 -O2
15
+#CC = cc
16
+CFLAGS += -I.. -I../gwnum -I%%LOCALBASE%%/include -DX86_64
17
 
18
-CPP = cc
19
-CPPFLAGS = -I.. -I../gwnum -DX86_64 -O2
20
+CPP = ${CXX}
21
+CPPFLAGS = ${CXXFLAGS} -I.. -I../gwnum -DX86_64
22
 
23
-LFLAGS = -L/usr/local/lib -Wl,-M
24
-LIBS = ../gwnum/gwnum.a ../gwnum/gwnum.ld -lm -lpthread /usr/local/lib/libhwloc.a -lcurl -lstdc++ -lcompat -lgmp
25
+LFLAGS += -L%%LOCALBASE%%/lib ${LDFLAGS}
26
+LIBS += ../gwnum/gwnum.a ../gwnum/gwnum.ld -lm -lpthread -lhwloc -lcurl -lcompat -lgmp
27
 
28
 FACTOROBJ = factor64.o
29
 OBJS = prime.o menu.o
(-)math/mprime/files/patch-linux_makebsd (-23 lines)
Lines 1-23 Link Here
1
--- linux/makebsd.orig	2016-10-30 18:42:16 UTC
2
+++ linux/makebsd
3
@@ -4,14 +4,14 @@
4
 # Configure hwloc with --enable-static --disable-shared --disable-pci --disable-cuda --disable-gl
5
 #
6
 
7
-CC = gcc
8
-CFLAGS = -I.. -I../gwnum -I/usr/local/include -O2 -march=i486 -malign-double
9
+#CC = cc
10
+CFLAGS = -I.. -I../gwnum -I%%LOCALBASE%%/include -O2 -march=i486
11
 
12
-CPP = g++
13
-CPPFLAGS = -I.. -I../gwnum -I/usr/local/include -O2 -march=i486 -malign-double
14
+CPP = ${CXX}
15
+CPPFLAGS = ${CXXFLAGS} -I.. -I../gwnum -I%%LOCALBASE%%/include -O2 -march=i486
16
 
17
-LFLAGS = -Wl,-M -L/usr/local/lib
18
-LIBS = ../gwnum/gwnum.a ../gwnum/gwnum.ld -lm -lpthread -Wl,-Bstatic /usr/local/lib/libhwloc.a -Wl,-Bstatic /usr/local/lib/libcurl.a -lz -lcompat -lstdc++ -Wl,-Bdynamic -lssl -lgmp
19
+LFLAGS = -L%%LOCALBASE%%/lib ${LDFLAGS}
20
+LIBS = ../gwnum/gwnum.a ../gwnum/gwnum.ld -lm -lpthread -lcurl -lhwloc -lz -lcompat -lssl -lgmp
21
 
22
 FACTOROBJ = factor32.o
23
 OBJS = prime.o menu.o

Return to bug 237844