vegas 6.2.1__cp311-cp311-macosx_11_0_arm64.whl → 6.3__cp311-cp311-macosx_11_0_arm64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of vegas might be problematic. Click here for more details.

Binary file
vegas/_vegas.pxd CHANGED
@@ -37,6 +37,7 @@ cdef class Integrator:
37
37
  cdef public Py_ssize_t min_neval_batch
38
38
  cdef public Py_ssize_t maxinc_axis
39
39
  cdef public Py_ssize_t max_neval_hcube
40
+ cdef public bint gpu_pad
40
41
  cdef public double neval_frac
41
42
  cdef public double max_mem
42
43
  cdef public Py_ssize_t nitn
vegas/_vegas.pyx CHANGED
@@ -1022,16 +1022,28 @@ cdef class Integrator(object):
1022
1022
  is ``analyzer=None``.
1023
1023
  min_neval_batch (positive int): The minimum number of integration
1024
1024
  points to be passed together to the integrand when using
1025
- |vegas| in batch mode. The default value is 50,000. Larger
1025
+ |vegas| in batch mode. The default value is 100,000. Larger
1026
1026
  values may be lead to faster evaluations, but at the cost of
1027
- more memory for internal work arrays. The last batch is
1028
- usually smaller than this limit, as it is limited by ``neval``.
1027
+ more memory for internal work arrays. Batch sizes are all smaller
1028
+ than the lesser of ``min_neval_batch + max_neval_hcube`` and
1029
+ ``neval``. The last batch is usually smaller than this limit,
1030
+ as it is limited by ``neval``.
1029
1031
  max_neval_hcube (positive int): Maximum number of integrand
1030
1032
  evaluations per hypercube in the stratification. The default
1031
1033
  value is 50,000. Larger values might allow for more adaptation
1032
1034
  (when ``beta>0``), but also allow for more over-shoot when
1033
1035
  adapting to sharp peaks. Larger values also can result in
1034
1036
  large internal work arrasy.
1037
+ gpu_pad (bool): If ``True``, |vegas| batches are padded so that
1038
+ they are all the same size. The extra integrand evaluations
1039
+ for integration points in the pad are discarded; increase
1040
+ ``min_neval_batch`` or reduce ``max_neval_hcube`` to
1041
+ decrease the number of evaluations that are discarded.
1042
+ Padding is usually minimal when ``min_neval_batch`` is
1043
+ equal to or larger than ``neval``. Padding can make
1044
+ GPU-based integrands work much faster, but it makes
1045
+ other types of integrand run more slowly.
1046
+ Default is ``False``.
1035
1047
  minimize_mem (bool): When ``True``, |vegas| minimizes
1036
1048
  internal workspace by moving some of its data to
1037
1049
  a disk file. This increases execution time (slightly)
@@ -1100,8 +1112,9 @@ cdef class Integrator(object):
1100
1112
  map=None, # integration region, AdaptiveMap, or Integrator
1101
1113
  neval=1000, # number of evaluations per iteration
1102
1114
  maxinc_axis=1000, # number of adaptive-map increments per axis
1103
- min_neval_batch=50000, # min. number of evaluations per batch
1115
+ min_neval_batch=100000, # min. number of evaluations per batch
1104
1116
  max_neval_hcube=50000, # max number of evaluations per h-cube
1117
+ gpu_pad=False, # pad batches for use by GPUs
1105
1118
  neval_frac=0.75, # fraction of evaluations used for adaptive stratified sampling
1106
1119
  max_mem=1e9, # memory cutoff (# of floats)
1107
1120
  nitn=10, # number of iterations
@@ -1407,10 +1420,20 @@ cdef class Integrator(object):
1407
1420
  self.sum_sigf = nsigf
1408
1421
  self.neval_hcube = numpy.empty(self.min_neval_batch // 2 + 1, dtype=numpy.intp)
1409
1422
  self.neval_hcube[:] = avg_neval_hcube
1410
- self.y = numpy.empty((self.min_neval_batch, self.dim), float)
1411
- self.x = numpy.empty((self.min_neval_batch, self.dim), float)
1412
- self.jac = numpy.empty(self.min_neval_batch, float)
1413
- self.fdv2 = numpy.empty(self.min_neval_batch, float)
1423
+ # allocate work space
1424
+ # self.y = numpy.empty((self.min_neval_batch, self.dim), float)
1425
+ # self.x = numpy.empty((self.min_neval_batch, self.dim), float)
1426
+ # self.jac = numpy.empty(self.min_neval_batch, float)
1427
+ # self.fdv2 = numpy.empty(self.min_neval_batch, float)
1428
+ workspace = self.min_neval_batch + self.max_neval_hcube
1429
+ if workspace > self.neval:
1430
+ workspace = self.neval + 1
1431
+ if (3*self.dim + 3) * workspace + (0 if self.minimize_mem else self.nhcube) > self.max_mem:
1432
+ raise MemoryError('work arrays larger than max_mem; reduce min_neval_batch or max_neval_hcube (or increase max_mem)')
1433
+ self.y = numpy.empty((workspace, self.dim), float)
1434
+ self.x = numpy.empty((workspace, self.dim), float)
1435
+ self.jac = numpy.empty(workspace, float)
1436
+ self.fdv2 = numpy.empty(workspace, float)
1414
1437
  return old_val
1415
1438
 
1416
1439
  def settings(Integrator self not None, ngrid=0):
@@ -1676,11 +1699,12 @@ cdef class Integrator(object):
1676
1699
  ############################## have enough points => build yields
1677
1700
  self.last_neval += neval_batch
1678
1701
  nhcube_batch = hcube - hcube_base + 1
1679
- if (3*self.dim + 3) * neval_batch * 2 > self.max_mem:
1680
- raise MemoryError('work arrays larger than max_mem; reduce min_neval_batch or max_neval_hcube (or increase max_mem)')
1702
+ # if (3*self.dim + 3) * neval_batch * 2 > self.max_mem:
1703
+ # raise MemoryError('work arrays larger than max_mem; reduce min_neval_batch or max_neval_hcube (or increase max_mem)')
1681
1704
 
1682
1705
  # 1) resize work arrays if needed (to double what is needed)
1683
1706
  if neval_batch > self.y.shape[0]:
1707
+ print("XXX - shouldn't get here ever")
1684
1708
  self.y = numpy.empty((2 * neval_batch, self.dim), float)
1685
1709
  self.x = numpy.empty((2 * neval_batch, self.dim), float)
1686
1710
  self.jac = numpy.empty(2 * neval_batch, float)
@@ -2000,9 +2024,10 @@ cdef class Integrator(object):
2000
2024
  cdef bint adaptive_strat
2001
2025
  cdef double sum_sigf, sigf2
2002
2026
  cdef bint firsteval = True
2003
-
2027
+ cdef bint gpu_pad
2004
2028
  if kargs:
2005
2029
  self.set(kargs)
2030
+ gpu_pad = self.gpu_pad and (self.beta != 0) and (self.adapt == True)
2006
2031
  if self.nproc > 1:
2007
2032
  old_defaults = self.set(mpi=False, min_neval_batch=self.nproc * self.min_neval_batch)
2008
2033
  elif self.mpi:
@@ -2053,7 +2078,11 @@ cdef class Integrator(object):
2053
2078
  len_hcube = len(hcube)
2054
2079
 
2055
2080
  # evaluate integrand at all points in x
2056
- xa = numpy.asarray(x)
2081
+ if gpu_pad:
2082
+ xa = numpy.asarray(self.x)
2083
+ xa[len(x):] = xa[len(x) - 1]
2084
+ else:
2085
+ xa = numpy.asarray(x)
2057
2086
  if self.nproc > 1:
2058
2087
  nx = x.shape[0] // self.nproc + 1
2059
2088
  if self.uses_jac:
@@ -2076,6 +2105,8 @@ cdef class Integrator(object):
2076
2105
  fcn.eval(xa, jac=self.map.jac1d(y) if self.uses_jac else None),
2077
2106
  dtype=float
2078
2107
  )
2108
+ if gpu_pad:
2109
+ fx = fx[:len(x)]
2079
2110
  # sanity check
2080
2111
  if numpy.any(numpy.isnan(fx)):
2081
2112
  raise ValueError('integrand evaluates to nan')
@@ -3193,7 +3224,7 @@ cdef class _BatchIntegrand_from_NonBatch(_BatchIntegrand_from_Base):
3193
3224
  for i in range(x.shape[0]):
3194
3225
  if self.std_arg:
3195
3226
  fx = numpy.asarray(
3196
- self.fcn(x[i]) if jac is None else self.fcn(x[i], jac=jac[i])
3227
+ self.fcn(numpy.asarray(x[i])) if jac is None else self.fcn(numpy.asarray(x[i]), jac=jac[i])
3197
3228
  ).reshape((-1,))
3198
3229
  else:
3199
3230
  fx = numpy.asarray(
@@ -3220,7 +3251,7 @@ cdef class _BatchIntegrand_from_NonBatchDict(_BatchIntegrand_from_Base):
3220
3251
  f = _f
3221
3252
  for i in range(x.shape[0]):
3222
3253
  if self.std_arg:
3223
- fx = self.fcn(x[i]) if jac is None else self.fcn(x[i], jac=jac[i])
3254
+ fx = self.fcn(numpy.asarray(x[i])) if jac is None else self.fcn(numpy.asarray(x[i]), jac=jac[i])
3224
3255
  else:
3225
3256
  fx = self.non_std_arg_fcn(x[i], None if jac is None else jac[i])
3226
3257
  if not isinstance(fx, gvar.BufferDict):
vegas/_version.py CHANGED
@@ -1 +1 @@
1
- __version__ = '6.2.1'
1
+ __version__ = '6.3'
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.4
2
2
  Name: vegas
3
- Version: 6.2.1
3
+ Version: 6.3
4
4
  Summary: Tools for adaptive multidimensional Monte Carlo integration.
5
5
  Home-page: https://github.com/gplepage/vegas
6
6
  Author: G. Peter Lepage
@@ -10,6 +10,7 @@ Requires-Python: >=3.9
10
10
  License-File: LICENSE.txt
11
11
  Requires-Dist: numpy>=1.24
12
12
  Requires-Dist: gvar>=13.1.5
13
+ Dynamic: license-file
13
14
 
14
15
  vegas
15
16
  -----
@@ -0,0 +1,12 @@
1
+ vegas-6.3.dist-info/RECORD,,
2
+ vegas-6.3.dist-info/WHEEL,sha256=HKX7-Mz4yMItvsyjNbv7XRr_XUc-QGa74o4zKQWXE3E,109
3
+ vegas-6.3.dist-info/top_level.txt,sha256=rnAmsIvsHyplln9ev-uw4hM7slW7VUdBQu9VgX8knkE,6
4
+ vegas-6.3.dist-info/METADATA,sha256=4KvST2MT_ZtVW5m9JLwgtVQoIT0dVuDx3M4atZAap5E,1859
5
+ vegas-6.3.dist-info/licenses/LICENSE.txt,sha256=YQSKRpj-PNC7SScHem3AECgwVONM-whKrs74SDueZxM,31996
6
+ vegas/_version.py,sha256=iP7h9eJI7GVtPYoAAelucGQh4W62_QNrdVQ4ejRh75c,20
7
+ vegas/__init__.pxd,sha256=MzfsI-0xD0rFnyHl1UFXz-2wSvGjfGA9QFKuCTr5nhs,646
8
+ vegas/_vegas.cpython-311-darwin.so,sha256=r_14Vk2PwLniuDy40HQ_Z8-phv_OjQo1_BtDAMu8D40,1220976
9
+ vegas/__init__.py,sha256=VF63mI8ggVcBshf8b-Fyd3RHWKRKf8wRBp6q0hM2hCI,55856
10
+ vegas/_vegas.pyx,sha256=jPucyvqP6q8W4RHi_u2rMh5f6WV_rQbjy4qAJC6lU-8,145396
11
+ vegas/_vegas.pxd,sha256=Kb0EwRSk4GMJ-9xKHMBtpb4BTZOrrR6OpFl7jSfZQGs,2849
12
+ vegas/_vegas.c,sha256=xLUZGdbuhkdAxQovgepM43SsDsQamP42fGMUhy2yBuA,5392682
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.8.0)
2
+ Generator: setuptools (80.8.0)
3
3
  Root-Is-Purelib: false
4
4
  Tag: cp311-cp311-macosx_11_0_arm64
5
5
 
@@ -1,12 +0,0 @@
1
- vegas/_version.py,sha256=e0q4qKyTER5JLaYQneFCwwG22qg0RCZ2Sv-1AVcD-X4,22
2
- vegas/__init__.pxd,sha256=MzfsI-0xD0rFnyHl1UFXz-2wSvGjfGA9QFKuCTr5nhs,646
3
- vegas/_vegas.cpython-311-darwin.so,sha256=BWiMBPuQ7Ys9uKfxix_pmTbi9oDc7QAg_mmdVFrWFwQ,1291872
4
- vegas/__init__.py,sha256=VF63mI8ggVcBshf8b-Fyd3RHWKRKf8wRBp6q0hM2hCI,55856
5
- vegas/_vegas.pyx,sha256=m-1DhOrHU0crKizoorIVaMrqZjaKcjrpV4R1gZZObn8,143512
6
- vegas/_vegas.pxd,sha256=45thucrIjqD40SY8KjBPs9Q9hfPxONL3wEpE5u7TMbc,2820
7
- vegas/_vegas.c,sha256=hke2rI-f0op-SEZwxHwGkI0LMKXxf6_2Nyyq0oueM4w,5433997
8
- vegas-6.2.1.dist-info/RECORD,,
9
- vegas-6.2.1.dist-info/WHEEL,sha256=NW1RskY9zow1Y68W-gXg0oZyBRAugI1JHywIzAIai5o,109
10
- vegas-6.2.1.dist-info/top_level.txt,sha256=rnAmsIvsHyplln9ev-uw4hM7slW7VUdBQu9VgX8knkE,6
11
- vegas-6.2.1.dist-info/LICENSE.txt,sha256=YQSKRpj-PNC7SScHem3AECgwVONM-whKrs74SDueZxM,31996
12
- vegas-6.2.1.dist-info/METADATA,sha256=hrBofhV44fPLXm_VF2WY8YTcVbzTGIfQBFkG0woRimU,1839