Generic fix and path update
This commit is contained in:
parent
019480c0e0
commit
07cfe4137f
2
external/external_build.cmake
vendored
2
external/external_build.cmake
vendored
@ -5,7 +5,7 @@ OPTION(ENABLE_OPENMP "Set to Yes if Healpix and/or you need openMP" OFF)
|
|||||||
SET(FFTW_URL "http://www.fftw.org/fftw-3.3.3.tar.gz" CACHE URL "URL to download FFTW from")
|
SET(FFTW_URL "http://www.fftw.org/fftw-3.3.3.tar.gz" CACHE URL "URL to download FFTW from")
|
||||||
SET(EIGEN_URL "http://bitbucket.org/eigen/eigen/get/3.2.10.tar.gz" CACHE URL "URL to download Eigen from")
|
SET(EIGEN_URL "http://bitbucket.org/eigen/eigen/get/3.2.10.tar.gz" CACHE URL "URL to download Eigen from")
|
||||||
SET(GENGETOPT_URL "ftp://ftp.gnu.org/gnu/gengetopt/gengetopt-2.22.5.tar.gz" CACHE STRING "URL to download gengetopt from")
|
SET(GENGETOPT_URL "ftp://ftp.gnu.org/gnu/gengetopt/gengetopt-2.22.5.tar.gz" CACHE STRING "URL to download gengetopt from")
|
||||||
SET(HDF5_URL "https://support.hdfgroup.org/ftp/HDF5/current18/src/hdf5-1.8.18.tar.bz2" CACHE STRING "URL to download HDF5 from")
|
SET(HDF5_URL "https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-1.8/hdf5-1.8.18/src/hdf5-1.8.18.tar.gz" CACHE STRING "URL to download HDF5 from")
|
||||||
SET(NETCDF_URL "http://www.unidata.ucar.edu/downloads/netcdf/ftp/netcdf-4.1.3.tar.gz" CACHE STRING "URL to download NetCDF from")
|
SET(NETCDF_URL "http://www.unidata.ucar.edu/downloads/netcdf/ftp/netcdf-4.1.3.tar.gz" CACHE STRING "URL to download NetCDF from")
|
||||||
SET(BOOST_URL "http://sourceforge.net/projects/boost/files/boost/1.61.0/boost_1_61_0.tar.gz/download" CACHE STRING "URL to download Boost from")
|
SET(BOOST_URL "http://sourceforge.net/projects/boost/files/boost/1.61.0/boost_1_61_0.tar.gz/download" CACHE STRING "URL to download Boost from")
|
||||||
SET(GSL_URL "ftp://ftp.gnu.org/gnu/gsl/gsl-1.15.tar.gz" CACHE STRING "URL to download GSL from ")
|
SET(GSL_URL "ftp://ftp.gnu.org/gnu/gsl/gsl-1.15.tar.gz" CACHE STRING "URL to download GSL from ")
|
||||||
|
@ -74,6 +74,9 @@ if (NOT PYTHON_SITE_PACKAGES)
|
|||||||
mark_as_advanced(USER_PYTHON_SITE_PACKAGES SYSTEM_PYTHON_SITE_PACKAGES)
|
mark_as_advanced(USER_PYTHON_SITE_PACKAGES SYSTEM_PYTHON_SITE_PACKAGES)
|
||||||
endif (NOT PYTHON_SITE_PACKAGES)
|
endif (NOT PYTHON_SITE_PACKAGES)
|
||||||
|
|
||||||
|
message(STATUS "System python site: ${SYSTEM_PYTHON_SITE_PACKAGES}")
|
||||||
|
message(STATUS "User python site: ${USER_PYTHON_SITE_PACKAGES}")
|
||||||
|
|
||||||
OPTION(INSTALL_PYTHON_LOCAL OFF)
|
OPTION(INSTALL_PYTHON_LOCAL OFF)
|
||||||
|
|
||||||
IF (NOT INSTALL_PYTHON_LOCAL)
|
IF (NOT INSTALL_PYTHON_LOCAL)
|
||||||
@ -81,6 +84,7 @@ IF (NOT INSTALL_PYTHON_LOCAL)
|
|||||||
ELSE (NOT INSTALL_PYTHON_LOCAL)
|
ELSE (NOT INSTALL_PYTHON_LOCAL)
|
||||||
SET(PYTHON_SITE_PACKAGES ${USER_PYTHON_SITE_PACKAGES})
|
SET(PYTHON_SITE_PACKAGES ${USER_PYTHON_SITE_PACKAGES})
|
||||||
ENDIF(NOT INSTALL_PYTHON_LOCAL)
|
ENDIF(NOT INSTALL_PYTHON_LOCAL)
|
||||||
|
cmessage(STATUS "Python install location: ${PYTHON_SITE_PACKAGES}")
|
||||||
|
|
||||||
|
|
||||||
if (WIN32 AND NOT CYGWIN)
|
if (WIN32 AND NOT CYGWIN)
|
||||||
|
@ -388,6 +388,7 @@ def loadGadget(str filename, int snapshot_id, int gadgetFormat = 1, bool loadPos
|
|||||||
cdef int flags
|
cdef int flags
|
||||||
cdef SimuData *data
|
cdef SimuData *data
|
||||||
cdef Simulation simu
|
cdef Simulation simu
|
||||||
|
cdef const char *filename_bs
|
||||||
|
|
||||||
flags = 0
|
flags = 0
|
||||||
if loadPosition:
|
if loadPosition:
|
||||||
@ -401,7 +402,10 @@ def loadGadget(str filename, int snapshot_id, int gadgetFormat = 1, bool loadPos
|
|||||||
if loadMass:
|
if loadMass:
|
||||||
flags |= NEED_MASS
|
flags |= NEED_MASS
|
||||||
|
|
||||||
data = loadGadgetMulti(filename, snapshot_id, flags, gadgetFormat)
|
filename_b = bytes(filename, 'utf-8')
|
||||||
|
filename_bs = filename_b
|
||||||
|
with nogil:
|
||||||
|
data = loadGadgetMulti(filename_bs, snapshot_id, flags, gadgetFormat)
|
||||||
if data == <SimuData*>0:
|
if data == <SimuData*>0:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
@ -404,9 +404,6 @@ cdef void INTERNAL_project_cic_no_mass(npx.ndarray[DTYPE_t, ndim=3] g,
|
|||||||
if b[j] < 0 or b[j]+1 >= Ngrid:
|
if b[j] < 0 or b[j]+1 >= Ngrid:
|
||||||
do_not_put = True
|
do_not_put = True
|
||||||
|
|
||||||
print("b = %g %g %g" % (b[0], b[1], b[2]))
|
|
||||||
print("a = %g %g %g" % (a[0], a[1], a[2]))
|
|
||||||
|
|
||||||
if not do_not_put:
|
if not do_not_put:
|
||||||
g[b[0],b[1],b[2]] += c[0]*c[1]*c[2]
|
g[b[0],b[1],b[2]] += c[0]*c[1]*c[2]
|
||||||
g[b[0]+1,b[1],b[2]] += a[0]*c[1]*c[2]
|
g[b[0]+1,b[1],b[2]] += a[0]*c[1]*c[2]
|
||||||
|
@ -4,14 +4,23 @@ import numpy as np
|
|||||||
import numexpr as ne
|
import numexpr as ne
|
||||||
|
|
||||||
class CubeFT(object):
|
class CubeFT(object):
|
||||||
def __init__(self, L, N, max_cpu=-1):
|
def __init__(self, L, N, max_cpu=-1, width=32):
|
||||||
|
|
||||||
|
if width==32:
|
||||||
|
fourier_type='complex64'
|
||||||
|
real_type='float32'
|
||||||
|
elif width==64:
|
||||||
|
fourier_type='complex128'
|
||||||
|
real_type='float64'
|
||||||
|
else:
|
||||||
|
raise ValueError("Invalid bitwidth (must be 32 or 64)")
|
||||||
|
|
||||||
self.N = N
|
self.N = N
|
||||||
self.align = pyfftw.simd_alignment
|
self.align = pyfftw.simd_alignment
|
||||||
self.L = float(L)
|
self.L = float(L)
|
||||||
self.max_cpu = multiprocessing.cpu_count() if max_cpu < 0 else max_cpu
|
self.max_cpu = multiprocessing.cpu_count() if max_cpu < 0 else max_cpu
|
||||||
self._dhat = pyfftw.n_byte_align_empty((self.N,self.N,self.N/2+1), self.align, dtype='complex64')
|
self._dhat = pyfftw.n_byte_align_empty((self.N,self.N,self.N/2+1), self.align, dtype=fourier_type)
|
||||||
self._density = pyfftw.n_byte_align_empty((self.N,self.N,self.N), self.align, dtype='float32')
|
self._density = pyfftw.n_byte_align_empty((self.N,self.N,self.N), self.align, dtype=real_type)
|
||||||
self._irfft = pyfftw.FFTW(self._dhat, self._density, axes=(0,1,2), direction='FFTW_BACKWARD', threads=self.max_cpu)#, normalize_idft=False)
|
self._irfft = pyfftw.FFTW(self._dhat, self._density, axes=(0,1,2), direction='FFTW_BACKWARD', threads=self.max_cpu)#, normalize_idft=False)
|
||||||
self._rfft = pyfftw.FFTW(self._density, self._dhat, axes=(0,1,2), threads=self.max_cpu) #, normalize_idft=False)
|
self._rfft = pyfftw.FFTW(self._density, self._dhat, axes=(0,1,2), threads=self.max_cpu) #, normalize_idft=False)
|
||||||
|
|
||||||
|
@ -14,6 +14,7 @@ class SimulationBare(PySimulationBase):
|
|||||||
self.positions = [q.copy() for q in s.getPositions()] if s.getPositions() is not None else None
|
self.positions = [q.copy() for q in s.getPositions()] if s.getPositions() is not None else None
|
||||||
self.velocities = [q.copy() for q in s.getVelocities()] if s.getVelocities() is not None else None
|
self.velocities = [q.copy() for q in s.getVelocities()] if s.getVelocities() is not None else None
|
||||||
self.identifiers = s.getIdentifiers().copy() if s.getIdentifiers() is not None else None
|
self.identifiers = s.getIdentifiers().copy() if s.getIdentifiers() is not None else None
|
||||||
|
self.types = s.getTypes().copy() if s.getTypes() is not None else None
|
||||||
self.boxsize = s.getBoxsize()
|
self.boxsize = s.getBoxsize()
|
||||||
self.time = s.getTime()
|
self.time = s.getTime()
|
||||||
self.Hubble = s.getHubble()
|
self.Hubble = s.getHubble()
|
||||||
@ -53,11 +54,15 @@ class SimulationBare(PySimulationBase):
|
|||||||
self.positions = _safe_merge(self.positions, other.getPositions())
|
self.positions = _safe_merge(self.positions, other.getPositions())
|
||||||
self.velocities = _safe_merge(self.velocities, other.getVelocities())
|
self.velocities = _safe_merge(self.velocities, other.getVelocities())
|
||||||
self.identifiers = _safe_merge0(self.identifiers, other.getIdentifiers())
|
self.identifiers = _safe_merge0(self.identifiers, other.getIdentifiers())
|
||||||
|
self.types = _safe_merge0(self.types, other.getTypes())
|
||||||
try:
|
try:
|
||||||
self.masses = _safe_merge0(self.masses, other.getMasses())
|
self.masses = _safe_merge0(self.masses, other.getMasses())
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
warnings.warn("Unexpected exception: " + repr(e));
|
warnings.warn("Unexpected exception: " + repr(e));
|
||||||
self.masses = None
|
self.masses = None
|
||||||
|
|
||||||
|
def getTypes(self):
|
||||||
|
return self.types
|
||||||
|
|
||||||
def getPositions(self):
|
def getPositions(self):
|
||||||
return self.positions
|
return self.positions
|
||||||
|
Loading…
Reference in New Issue
Block a user