PyQUDA-Utils 0.9.9.dev6__tar.gz → 0.9.9.dev8__tar.gz
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.
- {pyquda_utils-0.9.9.dev6 → pyquda_utils-0.9.9.dev8}/PKG-INFO +1 -1
- {pyquda_utils-0.9.9.dev6 → pyquda_utils-0.9.9.dev8}/PyQUDA_Utils.egg-info/PKG-INFO +1 -1
- pyquda_utils-0.9.9.dev8/pyquda_utils/_version.py +1 -0
- {pyquda_utils-0.9.9.dev6 → pyquda_utils-0.9.9.dev8}/pyquda_utils/io/__init__.py +11 -5
- pyquda_utils-0.9.9.dev8/pyquda_utils/io/nersc.py +123 -0
- pyquda_utils-0.9.9.dev6/pyquda_utils/_version.py +0 -1
- pyquda_utils-0.9.9.dev6/pyquda_utils/io/nersc.py +0 -67
- {pyquda_utils-0.9.9.dev6 → pyquda_utils-0.9.9.dev8}/LICENSE +0 -0
- {pyquda_utils-0.9.9.dev6 → pyquda_utils-0.9.9.dev8}/MANIFEST.in +0 -0
- {pyquda_utils-0.9.9.dev6 → pyquda_utils-0.9.9.dev8}/PyQUDA_Utils.egg-info/SOURCES.txt +0 -0
- {pyquda_utils-0.9.9.dev6 → pyquda_utils-0.9.9.dev8}/PyQUDA_Utils.egg-info/dependency_links.txt +0 -0
- {pyquda_utils-0.9.9.dev6 → pyquda_utils-0.9.9.dev8}/PyQUDA_Utils.egg-info/requires.txt +0 -0
- {pyquda_utils-0.9.9.dev6 → pyquda_utils-0.9.9.dev8}/PyQUDA_Utils.egg-info/top_level.txt +0 -0
- {pyquda_utils-0.9.9.dev6 → pyquda_utils-0.9.9.dev8}/README.md +0 -0
- {pyquda_utils-0.9.9.dev6 → pyquda_utils-0.9.9.dev8}/pyproject.toml +0 -0
- {pyquda_utils-0.9.9.dev6 → pyquda_utils-0.9.9.dev8}/pyquda_utils/__init__.py +0 -0
- {pyquda_utils-0.9.9.dev6 → pyquda_utils-0.9.9.dev8}/pyquda_utils/convert.py +0 -0
- {pyquda_utils-0.9.9.dev6 → pyquda_utils-0.9.9.dev8}/pyquda_utils/core.py +0 -0
- {pyquda_utils-0.9.9.dev6 → pyquda_utils-0.9.9.dev8}/pyquda_utils/deprecated.py +0 -0
- {pyquda_utils-0.9.9.dev6 → pyquda_utils-0.9.9.dev8}/pyquda_utils/gamma.py +0 -0
- {pyquda_utils-0.9.9.dev6 → pyquda_utils-0.9.9.dev8}/pyquda_utils/gpt.py +0 -0
- {pyquda_utils-0.9.9.dev6 → pyquda_utils-0.9.9.dev8}/pyquda_utils/hmc_param.py +0 -0
- {pyquda_utils-0.9.9.dev6 → pyquda_utils-0.9.9.dev8}/pyquda_utils/io/chroma.py +0 -0
- {pyquda_utils-0.9.9.dev6 → pyquda_utils-0.9.9.dev8}/pyquda_utils/io/io_general.py +0 -0
- {pyquda_utils-0.9.9.dev6 → pyquda_utils-0.9.9.dev8}/pyquda_utils/io/kyu.py +0 -0
- {pyquda_utils-0.9.9.dev6 → pyquda_utils-0.9.9.dev8}/pyquda_utils/io/lime.py +0 -0
- {pyquda_utils-0.9.9.dev6 → pyquda_utils-0.9.9.dev8}/pyquda_utils/io/milc.py +0 -0
- {pyquda_utils-0.9.9.dev6 → pyquda_utils-0.9.9.dev8}/pyquda_utils/io/mpi_file.py +0 -0
- {pyquda_utils-0.9.9.dev6 → pyquda_utils-0.9.9.dev8}/pyquda_utils/io/npy.py +0 -0
- {pyquda_utils-0.9.9.dev6 → pyquda_utils-0.9.9.dev8}/pyquda_utils/io/openqcd.py +0 -0
- {pyquda_utils-0.9.9.dev6 → pyquda_utils-0.9.9.dev8}/pyquda_utils/io/xqcd.py +0 -0
- {pyquda_utils-0.9.9.dev6 → pyquda_utils-0.9.9.dev8}/pyquda_utils/milc_rhmc_param.py +0 -0
- {pyquda_utils-0.9.9.dev6 → pyquda_utils-0.9.9.dev8}/pyquda_utils/phase.py +0 -0
- {pyquda_utils-0.9.9.dev6 → pyquda_utils-0.9.9.dev8}/pyquda_utils/quasi_axial_gauge_fixing.py +0 -0
- {pyquda_utils-0.9.9.dev6 → pyquda_utils-0.9.9.dev8}/pyquda_utils/source.py +0 -0
- {pyquda_utils-0.9.9.dev6 → pyquda_utils-0.9.9.dev8}/setup.cfg +0 -0
- {pyquda_utils-0.9.9.dev6 → pyquda_utils-0.9.9.dev8}/setup.py +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.9.9.dev8"
|
|
@@ -259,15 +259,21 @@ def writeOpenQCDGauge(filename: str, gauge: LatticeGauge):
|
|
|
259
259
|
write(filename, gauge.latt_info.global_size, gauge.latt_info.grid_size, plaquette, gauge_.getHost())
|
|
260
260
|
|
|
261
261
|
|
|
262
|
-
def readNERSCGauge(filename: str,
|
|
262
|
+
def readNERSCGauge(filename: str, link_trace: bool = True, checksum: bool = True):
|
|
263
263
|
from pyquda import getGridSize
|
|
264
264
|
from .nersc import readGauge as read
|
|
265
265
|
|
|
266
266
|
latt_size, plaquette, gauge_raw = read(filename, getGridSize(), link_trace, checksum)
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
267
|
+
gauge = LatticeGauge(LatticeInfo(latt_size), cb2(gauge_raw, [1, 2, 3, 4]))
|
|
268
|
+
assert numpy.isclose(gauge.plaquette()[0], plaquette)
|
|
269
|
+
return gauge
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
def writeNERSCGauge(filename: str, gauge: LatticeGauge, float_nbytes: int = 8):
|
|
273
|
+
from .nersc import writeGauge as write
|
|
274
|
+
|
|
275
|
+
plaquette = gauge.plaquette()[0]
|
|
276
|
+
write(filename, gauge.latt_info.global_size, gauge.latt_info.grid_size, plaquette, gauge.lexico(), float_nbytes)
|
|
271
277
|
|
|
272
278
|
|
|
273
279
|
def readQIOGauge(filename: str):
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
from datetime import datetime
|
|
2
|
+
from os import path, uname
|
|
3
|
+
from typing import Dict, List
|
|
4
|
+
|
|
5
|
+
import numpy
|
|
6
|
+
from mpi4py import MPI
|
|
7
|
+
|
|
8
|
+
from .mpi_file import getSublatticeSize, readMPIFile, writeMPIFile
|
|
9
|
+
|
|
10
|
+
Nd, Ns, Nc = 4, 4, 3
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def checksum_nersc(data: numpy.ndarray) -> int:
|
|
14
|
+
return MPI.COMM_WORLD.allreduce(numpy.sum(data.view("<u4"), dtype="<u4"), MPI.SUM)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def link_trace_nersc(gauge: numpy.ndarray) -> float:
|
|
18
|
+
return MPI.COMM_WORLD.allreduce(
|
|
19
|
+
numpy.einsum("tzyxdaa->", gauge.real) / (MPI.COMM_WORLD.Get_size() * gauge.size // Nc), MPI.SUM
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def readGauge(filename: str, grid_size: List[int], link_trace: bool = True, checksum: bool = True):
|
|
24
|
+
filename = path.expanduser(path.expandvars(filename))
|
|
25
|
+
header: Dict[str, str] = {}
|
|
26
|
+
with open(filename, "rb") as f:
|
|
27
|
+
assert f.readline().decode() == "BEGIN_HEADER\n"
|
|
28
|
+
buffer = f.readline().decode()
|
|
29
|
+
while buffer != "END_HEADER\n":
|
|
30
|
+
key, val = buffer.split("=")
|
|
31
|
+
header[key.strip()] = val.strip()
|
|
32
|
+
buffer = f.readline().decode()
|
|
33
|
+
offset = f.tell()
|
|
34
|
+
latt_size = [
|
|
35
|
+
int(header["DIMENSION_1"]),
|
|
36
|
+
int(header["DIMENSION_2"]),
|
|
37
|
+
int(header["DIMENSION_3"]),
|
|
38
|
+
int(header["DIMENSION_4"]),
|
|
39
|
+
]
|
|
40
|
+
Lx, Ly, Lz, Lt = getSublatticeSize(latt_size, grid_size)
|
|
41
|
+
assert header["FLOATING_POINT"].startswith("IEEE")
|
|
42
|
+
if header["FLOATING_POINT"][6:] == "BIG":
|
|
43
|
+
endian = ">"
|
|
44
|
+
elif header["FLOATING_POINT"][6:] == "LITTLE":
|
|
45
|
+
endian = "<"
|
|
46
|
+
else:
|
|
47
|
+
raise ValueError(f"Unsupported endian: {header['FLOATING_POINT'][6:]}")
|
|
48
|
+
float_nbytes = int(header["FLOATING_POINT"][4:6]) // 8
|
|
49
|
+
dtype = f"{endian}c{2 * float_nbytes}"
|
|
50
|
+
plaquette = float(header["PLAQUETTE"])
|
|
51
|
+
|
|
52
|
+
if header["DATATYPE"] == "4D_SU3_GAUGE_3x3":
|
|
53
|
+
gauge = readMPIFile(filename, dtype, offset, (Lt, Lz, Ly, Lx, Nd, Nc, Nc), (3, 2, 1, 0), grid_size)
|
|
54
|
+
gauge = gauge.astype(f"<c{2 * float_nbytes}")
|
|
55
|
+
if link_trace:
|
|
56
|
+
assert numpy.isclose(link_trace_nersc(gauge), float(header["LINK_TRACE"])), f"Bad link trace for {filename}"
|
|
57
|
+
if checksum:
|
|
58
|
+
assert checksum_nersc(gauge.reshape(-1)) == int(header["CHECKSUM"], 16), f"Bad checksum for {filename}"
|
|
59
|
+
gauge = gauge.transpose(4, 0, 1, 2, 3, 5, 6).astype("<c16")
|
|
60
|
+
return latt_size, plaquette, gauge
|
|
61
|
+
elif header["DATATYPE"] == "4D_SU3_GAUGE":
|
|
62
|
+
# gauge = readMPIFile(filename, dtype, offset, (Lt, Lz, Ly, Lx, Nd, Nc - 1, Nc), (3, 2, 1, 0))
|
|
63
|
+
# if checksum:
|
|
64
|
+
# assert checksum_nersc(gauge.astype(f"<c{2 * nbytes}").reshape(-1)) == int(
|
|
65
|
+
# header["CHECKSUM"], 16
|
|
66
|
+
# ), f"Bad checksum for {filename}"
|
|
67
|
+
# gauge = gauge.transpose(4, 0, 1, 2, 3, 5, 6).astype("<c16")
|
|
68
|
+
# return latt_size, gauge
|
|
69
|
+
raise NotImplementedError("SU3_GAUGE is not supported")
|
|
70
|
+
else:
|
|
71
|
+
raise ValueError(f"Unsupported datatype: {header['DATATYPE']}")
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
def writeGauge(
|
|
75
|
+
filename: str,
|
|
76
|
+
latt_size: List[int],
|
|
77
|
+
grid_size: List[int],
|
|
78
|
+
plaquette: float,
|
|
79
|
+
gauge: numpy.ndarray,
|
|
80
|
+
float_nbytes: int = 8,
|
|
81
|
+
):
|
|
82
|
+
filename = path.expanduser(path.expandvars(filename))
|
|
83
|
+
dtype, offset = f"<c{2 * float_nbytes}", None
|
|
84
|
+
gauge = numpy.ascontiguousarray(gauge.transpose(1, 2, 3, 4, 0, 5, 6).astype(dtype))
|
|
85
|
+
link_trace = link_trace_nersc(gauge)
|
|
86
|
+
checksum = checksum_nersc(gauge.reshape(-1))
|
|
87
|
+
Lx, Ly, Lz, Lt = getSublatticeSize(latt_size, grid_size)
|
|
88
|
+
header: Dict[str, str] = {
|
|
89
|
+
"HDR_VERSION": "1.0",
|
|
90
|
+
"DATATYPE": "4D_SU3_GAUGE_3x3",
|
|
91
|
+
"STORAGE_FORMAT": "",
|
|
92
|
+
"DIMENSION_1": f"{latt_size[0]}",
|
|
93
|
+
"DIMENSION_2": f"{latt_size[1]}",
|
|
94
|
+
"DIMENSION_3": f"{latt_size[2]}",
|
|
95
|
+
"DIMENSION_4": f"{latt_size[3]}",
|
|
96
|
+
"LINK_TRACE": f"{link_trace:.10g}",
|
|
97
|
+
"PLAQUETTE": f"{plaquette:.10g}",
|
|
98
|
+
"BOUNDARY_1": "PERIODIC",
|
|
99
|
+
"BOUNDARY_2": "PERIODIC",
|
|
100
|
+
"BOUNDARY_3": "PERIODIC",
|
|
101
|
+
"BOUNDARY_4": "PERIODIC",
|
|
102
|
+
"CHECKSUM": f"{checksum:10x}",
|
|
103
|
+
"SCIDAC_CHECKSUMA": f"{0:10x}",
|
|
104
|
+
"SCIDAC_CHECKSUMB": f"{0:10x}",
|
|
105
|
+
"ENSEMBLE_ID": "pyquda",
|
|
106
|
+
"ENSEMBLE_LABEL": "",
|
|
107
|
+
"SEQUENCE_NUMBER": "1",
|
|
108
|
+
"CREATOR": "pyquda",
|
|
109
|
+
"CREATOR_HARDWARE": f"{uname().nodename}-{uname().machine}-{uname().sysname}-{uname().release}",
|
|
110
|
+
"CREATION_DATE": datetime.now().strftime(R"%a %b %d %H:%M:%S %Y %z"),
|
|
111
|
+
"ARCHIVE_DATE": datetime.now().strftime(R"%a %b %d %H:%M:%S %Y %z"),
|
|
112
|
+
"FLOATING_POINT": f"IEEE{float_nbytes * 8}LITTLE",
|
|
113
|
+
}
|
|
114
|
+
if MPI.COMM_WORLD.Get_rank() == 0:
|
|
115
|
+
with open(filename, "wb") as f:
|
|
116
|
+
f.write(b"BEGIN_HEADER\n")
|
|
117
|
+
for key, val in header.items():
|
|
118
|
+
f.write(f"{key} = {val}\n".encode())
|
|
119
|
+
f.write(b"END_HEADER\n")
|
|
120
|
+
offset = f.tell()
|
|
121
|
+
offset = MPI.COMM_WORLD.bcast(offset)
|
|
122
|
+
|
|
123
|
+
writeMPIFile(filename, dtype, offset, (Lt, Lz, Ly, Lx, Nd, Nc, Nc), (3, 2, 1, 0), grid_size, gauge)
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.9.9.dev6"
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
from os import path
|
|
2
|
-
from typing import Dict, List
|
|
3
|
-
|
|
4
|
-
import numpy
|
|
5
|
-
from mpi4py import MPI
|
|
6
|
-
|
|
7
|
-
from .mpi_file import getSublatticeSize, readMPIFile, writeMPIFile
|
|
8
|
-
|
|
9
|
-
Nd, Ns, Nc = 4, 4, 3
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
def checksum_nersc(data: numpy.ndarray) -> int:
|
|
13
|
-
return MPI.COMM_WORLD.allreduce(numpy.sum(data.view("<u4"), dtype="<u4"), MPI.SUM)
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
def readGauge(filename: str, grid_size: List[int], link_trace: bool = True, checksum: bool = True):
|
|
17
|
-
filename = path.expanduser(path.expandvars(filename))
|
|
18
|
-
header: Dict[str, str] = {}
|
|
19
|
-
with open(filename, "rb") as f:
|
|
20
|
-
assert f.readline().decode() == "BEGIN_HEADER\n"
|
|
21
|
-
buffer = f.readline().decode()
|
|
22
|
-
while buffer != "END_HEADER\n":
|
|
23
|
-
key, val = buffer.split("=")
|
|
24
|
-
header[key.strip()] = val.strip()
|
|
25
|
-
buffer = f.readline().decode()
|
|
26
|
-
offset = f.tell()
|
|
27
|
-
latt_size = [
|
|
28
|
-
int(header["DIMENSION_1"]),
|
|
29
|
-
int(header["DIMENSION_2"]),
|
|
30
|
-
int(header["DIMENSION_3"]),
|
|
31
|
-
int(header["DIMENSION_4"]),
|
|
32
|
-
]
|
|
33
|
-
Lx, Ly, Lz, Lt = getSublatticeSize(latt_size, grid_size)
|
|
34
|
-
assert header["FLOATING_POINT"].startswith("IEEE")
|
|
35
|
-
if header["FLOATING_POINT"][6:] == "BIG":
|
|
36
|
-
endian = ">"
|
|
37
|
-
elif header["FLOATING_POINT"][6:] == "LITTLE":
|
|
38
|
-
endian = "<"
|
|
39
|
-
else:
|
|
40
|
-
raise ValueError(f"Unsupported endian: {header['FLOATING_POINT'][6:]}")
|
|
41
|
-
nbytes = int(header["FLOATING_POINT"][4:6]) // 8
|
|
42
|
-
dtype = f"{endian}c{2 * nbytes}"
|
|
43
|
-
plaquette = float(header["PLAQUETTE"])
|
|
44
|
-
|
|
45
|
-
if header["DATATYPE"] == "4D_SU3_GAUGE_3x3":
|
|
46
|
-
gauge = readMPIFile(filename, dtype, offset, (Lt, Lz, Ly, Lx, Nd, Nc, Nc), (3, 2, 1, 0), grid_size)
|
|
47
|
-
if link_trace:
|
|
48
|
-
assert numpy.isclose(
|
|
49
|
-
numpy.einsum("tzyxdaa->", gauge.real) / (gauge.size // Nc), float(header["LINK_TRACE"])
|
|
50
|
-
), f"Bad link trace for {filename}"
|
|
51
|
-
if checksum:
|
|
52
|
-
assert checksum_nersc(gauge.astype(f"<c{2 * nbytes}").reshape(-1)) == int(
|
|
53
|
-
header["CHECKSUM"], 16
|
|
54
|
-
), f"Bad checksum for {filename}"
|
|
55
|
-
gauge = gauge.transpose(4, 0, 1, 2, 3, 5, 6).astype("<c16")
|
|
56
|
-
return latt_size, plaquette, gauge
|
|
57
|
-
elif header["DATATYPE"] == "4D_SU3_GAUGE":
|
|
58
|
-
# gauge = readMPIFile(filename, dtype, offset, (Lt, Lz, Ly, Lx, Nd, Nc - 1, Nc), (3, 2, 1, 0))
|
|
59
|
-
# if checksum:
|
|
60
|
-
# assert (
|
|
61
|
-
# hex(checksum_nersc(gauge.astype(f"<c{2 * nbytes}").reshape(-1)))[2:] == header["CHECKSUM"]
|
|
62
|
-
# ), f"Bad checksum for {filename}"
|
|
63
|
-
# gauge = gauge.transpose(4, 0, 1, 2, 3, 5, 6).astype("<c16")
|
|
64
|
-
# return latt_size, gauge
|
|
65
|
-
raise NotImplementedError("SU3_GAUGE is not supported")
|
|
66
|
-
else:
|
|
67
|
-
raise ValueError(f"Unsupported datatype: {header['DATATYPE']}")
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pyquda_utils-0.9.9.dev6 → pyquda_utils-0.9.9.dev8}/PyQUDA_Utils.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pyquda_utils-0.9.9.dev6 → pyquda_utils-0.9.9.dev8}/pyquda_utils/quasi_axial_gauge_fixing.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|