Skip to content

Commit e401645

Browse files
authored
Merge pull request #186 from manodeep/gridlink-memory-footprint
Reduce gridlink memory footprint
2 parents c86e7a1 + 9ed92bc commit e401645

15 files changed

Lines changed: 99 additions & 128 deletions

CHANGES.rst

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,17 @@ New features
1010
- conda installable package
1111
- GPU version
1212

13-
2.3.0 (upcoming)
13+
2.3.1 (upcoming)
1414
================
1515

16+
Enhancements
17+
------------
18+
- Reduce memory footprint of the cell pairs [#186]
19+
20+
21+
2.3.0 (2019-05-20)
22+
==================
23+
1624
**Breaking Changes**
1725
--------------------
1826

Corrfunc/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
unicode_literals)
1111
import os
1212

13-
__version__ = "2.3.0"
13+
__version__ = "2.3.1"
1414
__author__ = "Manodeep Sinha <manodeep@gmail.com>"
1515

1616

common.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ OPT += -DUSE_OMP
4141
DISTNAME:=Corrfunc
4242
MAJOR:=2
4343
MINOR:=3
44-
PATCHLEVEL:=0
44+
PATCHLEVEL:=1
4545
VERSION:=$(MAJOR).$(MINOR).$(PATCHLEVEL)
4646
ABI_COMPAT_VERSION:=$(MAJOR).0
4747
# Whenever conda needs to be checked again

mocks/DDrppi_mocks/countpairs_rp_pi_mocks_impl.c.src

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -625,10 +625,13 @@ int countpairs_mocks_DOUBLE(const int64_t ND1, DOUBLE *ra1, DOUBLE *dec1, DOUBLE
625625
DOUBLE *this_rpavg = options->need_avg_sep ? rpavg:NULL;
626626
DOUBLE *this_weightavg = need_weightavg ? weightavg:NULL;
627627

628-
const int status = countpairs_rp_pi_mocks_function_DOUBLE(this_cell_pair->N1, this_cell_pair->x1,
629-
this_cell_pair->y1, this_cell_pair->z1, this_cell_pair->weights1,
630-
this_cell_pair->N2, this_cell_pair->x2,
631-
this_cell_pair->y2, this_cell_pair->z2, this_cell_pair->weights2,
628+
const int64_t icell = this_cell_pair->cellindex1;
629+
const int64_t icell2 = this_cell_pair->cellindex2;
630+
const cellarray_mocks_DOUBLE *first = &lattice1[icell];
631+
const cellarray_mocks_DOUBLE *second = &lattice2[icell2];
632+
633+
const int status = countpairs_rp_pi_mocks_function_DOUBLE(first->nelements, first->x, first->y, first->z, &(first->weights),
634+
second->nelements, second->x, second->y, second->z, &(second->weights),
632635
this_cell_pair->same_cell,
633636
options->fast_divide_and_NR_steps,
634637
sqr_rpmax, sqr_rpmin, nrpbin, npibin, rupp_sqr, pimax,

mocks/DDsmu_mocks/countpairs_s_mu_mocks_impl.c.src

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -631,10 +631,13 @@ int countpairs_mocks_s_mu_DOUBLE(const int64_t ND1, DOUBLE *ra1, DOUBLE *dec1, D
631631
DOUBLE *this_savg = options->need_avg_sep ? &(savg[0]):NULL;
632632
DOUBLE *this_weightavg = need_weightavg ? weightavg:NULL;
633633

634-
const int status = countpairs_s_mu_mocks_function_DOUBLE(this_cell_pair->N1, this_cell_pair->x1,
635-
this_cell_pair->y1, this_cell_pair->z1, this_cell_pair->weights1,
636-
this_cell_pair->N2, this_cell_pair->x2,
637-
this_cell_pair->y2, this_cell_pair->z2, this_cell_pair->weights2,
634+
const int64_t icell = this_cell_pair->cellindex1;
635+
const int64_t icell2 = this_cell_pair->cellindex2;
636+
const cellarray_mocks_DOUBLE *first = &lattice1[icell];
637+
const cellarray_mocks_DOUBLE *second = &lattice2[icell2];
638+
639+
const int status = countpairs_s_mu_mocks_function_DOUBLE(first->nelements, first->x, first->y, first->z, &(first->weights),
640+
second->nelements, second->x, second->y, second->z, &(second->weights),
638641
this_cell_pair->same_cell,
639642
options->fast_divide_and_NR_steps,
640643
sqr_smax, sqr_smin, nsbin, nmu_bins, supp_sqr, mu_max,

mocks/DDtheta_mocks/countpairs_theta_mocks_impl.c.src

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1007,10 +1007,13 @@ int countpairs_theta_mocks_DOUBLE(const int64_t ND1, DOUBLE *ra1, DOUBLE *dec1,
10071007
DOUBLE *this_thetaavg = options->need_avg_sep ? thetaavg:NULL;
10081008
DOUBLE *this_weightavg = need_weightavg ? weightavg:NULL;
10091009

1010-
const int status = countpairs_theta_mocks_function_DOUBLE(this_cell_pair->N1, this_cell_pair->x1,
1011-
this_cell_pair->y1, this_cell_pair->z1, this_cell_pair->weights1,
1012-
this_cell_pair->N2, this_cell_pair->x2,
1013-
this_cell_pair->y2, this_cell_pair->z2, this_cell_pair->weights2,
1010+
const int64_t icell = this_cell_pair->cellindex1;
1011+
const int64_t icell2 = this_cell_pair->cellindex2;
1012+
const cellarray_mocks_DOUBLE *first = &lattice1[icell];
1013+
const cellarray_mocks_DOUBLE *second = &lattice2[icell2];
1014+
1015+
const int status = countpairs_theta_mocks_function_DOUBLE(first->nelements, first->x, first->y, first->z, &(first->weights),
1016+
second->nelements, second->x, second->y, second->z, &(second->weights),
10141017
this_cell_pair->same_cell,
10151018
options->fast_acos,
10161019
costhetamax, costhetamin, nthetabin,

theory/DD/countpairs_impl.c.src

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -452,10 +452,13 @@ int countpairs_DOUBLE(const int64_t ND1, DOUBLE *X1, DOUBLE *Y1, DOUBLE *Z1,
452452
DOUBLE *this_rpavg = options->need_avg_sep ? rpavg:NULL;
453453
DOUBLE *this_weightavg = need_weightavg ? weightavg:NULL;
454454

455-
const int status = countpairs_function_DOUBLE(this_cell_pair->N1, this_cell_pair->x1,
456-
this_cell_pair->y1, this_cell_pair->z1, this_cell_pair->weights1,
457-
this_cell_pair->N2, this_cell_pair->x2,
458-
this_cell_pair->y2, this_cell_pair->z2, this_cell_pair->weights2,
455+
const int64_t icell = this_cell_pair->cellindex1;
456+
const int64_t icell2 = this_cell_pair->cellindex2;
457+
const cellarray_DOUBLE *first = &lattice1[icell];
458+
const cellarray_DOUBLE *second = &lattice2[icell2];
459+
460+
const int status = countpairs_function_DOUBLE(first->nelements, first->x, first->y, first->z, &(first->weights),
461+
second->nelements, second->x, second->y, second->z, &(second->weights),
459462
this_cell_pair->same_cell,
460463
sqr_rpmax, sqr_rpmin, nrpbin, rupp_sqr, pimax, //pimax is simply rpmax cast to DOUBLE
461464
this_cell_pair->xwrap, this_cell_pair->ywrap, this_cell_pair->zwrap,

theory/DDrppi/countpairs_rp_pi_impl.c.src

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -446,10 +446,13 @@ int countpairs_rp_pi_DOUBLE(const int64_t ND1, DOUBLE *X1, DOUBLE *Y1, DOUBLE *Z
446446
DOUBLE *this_rpavg = options->need_avg_sep ? rpavg:NULL;
447447
DOUBLE *this_weightavg = need_weightavg ? weightavg:NULL;
448448

449-
const int status = countpairs_rp_pi_function_DOUBLE(this_cell_pair->N1, this_cell_pair->x1,
450-
this_cell_pair->y1, this_cell_pair->z1, this_cell_pair->weights1,
451-
this_cell_pair->N2, this_cell_pair->x2,
452-
this_cell_pair->y2, this_cell_pair->z2, this_cell_pair->weights2,
449+
const int64_t icell = this_cell_pair->cellindex1;
450+
const int64_t icell2 = this_cell_pair->cellindex2;
451+
const cellarray_DOUBLE *first = &lattice1[icell];
452+
const cellarray_DOUBLE *second = &lattice2[icell2];
453+
454+
const int status = countpairs_rp_pi_function_DOUBLE(first->nelements, first->x, first->y, first->z, &(first->weights),
455+
second->nelements, second->x, second->y, second->z, &(second->weights),
453456
this_cell_pair->same_cell,
454457
sqr_rpmax, sqr_rpmin, nrpbin, npibin, rupp_sqr, pimax,
455458
this_cell_pair->xwrap, this_cell_pair->ywrap, this_cell_pair->zwrap,

theory/DDsmu/countpairs_s_mu_impl.c.src

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -466,10 +466,13 @@ int countpairs_s_mu_DOUBLE(const int64_t ND1, DOUBLE *X1, DOUBLE *Y1, DOUBLE *Z1
466466
DOUBLE *this_rpavg = options->need_avg_sep ? savg:NULL;
467467
DOUBLE *this_weightavg = need_weightavg ? weightavg:NULL;
468468

469-
const int status = countpairs_s_mu_function_DOUBLE(this_cell_pair->N1, this_cell_pair->x1,
470-
this_cell_pair->y1, this_cell_pair->z1, this_cell_pair->weights1,
471-
this_cell_pair->N2, this_cell_pair->x2,
472-
this_cell_pair->y2, this_cell_pair->z2, this_cell_pair->weights2,
469+
const int64_t icell = this_cell_pair->cellindex1;
470+
const int64_t icell2 = this_cell_pair->cellindex2;
471+
const cellarray_DOUBLE *first = &lattice1[icell];
472+
const cellarray_DOUBLE *second = &lattice2[icell2];
473+
474+
const int status = countpairs_s_mu_function_DOUBLE(first->nelements, first->x, first->y, first->z, &(first->weights),
475+
second->nelements, second->x, second->y, second->z, &(second->weights),
473476
this_cell_pair->same_cell,
474477
options->fast_divide_and_NR_steps,
475478
sqr_smax, sqr_smin, nsbin, nmu_bins, supp_sqr, mu_max, pimax,

theory/wp/countpairs_wp_impl.c.src

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -427,10 +427,13 @@ int countpairs_wp_DOUBLE(const int64_t ND, DOUBLE * restrict X, DOUBLE * restric
427427
current_utc_time(&tcell_start);
428428
}
429429

430-
const int status = wp_function_DOUBLE(this_cell_pair->x1, this_cell_pair->y1, this_cell_pair->z1,
431-
this_cell_pair->weights1, this_cell_pair->N1,
432-
this_cell_pair->x2, this_cell_pair->y2, this_cell_pair->z2,
433-
this_cell_pair->weights2, this_cell_pair->N2,
430+
const int64_t icell = this_cell_pair->cellindex1;
431+
const int64_t icell2 = this_cell_pair->cellindex2;
432+
const cellarray_DOUBLE *first = &lattice[icell];
433+
const cellarray_DOUBLE *second = &lattice[icell2];
434+
435+
const int status = wp_function_DOUBLE(first->x, first->y, first->z, &(first->weights), first->nelements,
436+
second->x, second->y, second->z, &(second->weights), second->nelements,
434437
this_cell_pair->same_cell,
435438
sqr_rpmax, sqr_rpmin, nrpbins, rupp_sqr, pimax,
436439
this_cell_pair->xwrap, this_cell_pair->ywrap, this_cell_pair->zwrap,
@@ -448,7 +451,7 @@ int countpairs_wp_DOUBLE(const int64_t ND, DOUBLE * restrict X, DOUBLE * restric
448451
current_utc_time(&tcell_end);
449452
double time_in_ns = REALTIME_ELAPSED_NS(tcell_start, tcell_end);
450453
struct api_cell_timings *base_cell = &(options->cell_timings[icellpair]);
451-
ASSIGN_CELL_TIMINGS(base_cell, this_cell_pair->N1, this_cell_pair->N2, time_in_ns,
454+
ASSIGN_CELL_TIMINGS(base_cell, first->nelements, second->nelements, time_in_ns,
452455
tid, this_cell_pair->cellindex1, this_cell_pair->cellindex2);
453456
}
454457
}//abort-status

0 commit comments

Comments
 (0)