Skip to content

Commit bf4ce5e

Browse files
committed
Requested changes
1 parent 6632260 commit bf4ce5e

37 files changed

+490
-697
lines changed

.github/workflows/ci.yaml

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,12 @@ jobs:
6262
timeout-minutes: 20
6363
steps:
6464
- name: Check out a copy of the git repository
65-
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
65+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
6666
with:
6767
fetch-depth: 0
6868

6969
- name: Set up Python
70-
uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v5
70+
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v5
7171
with:
7272
python-version: ${{env.python-version}}
7373
cache: pip
@@ -101,7 +101,7 @@ jobs:
101101
timeout-minutes: 15
102102
steps:
103103
- name: Check out a copy of the git repository
104-
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
104+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
105105
with:
106106
fetch-depth: 0
107107

@@ -123,7 +123,7 @@ jobs:
123123
timeout-minutes: 15
124124
steps:
125125
- name: Check out a copy of the git repository
126-
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
126+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
127127
with:
128128
fetch-depth: 0
129129

@@ -146,7 +146,7 @@ jobs:
146146
timeout-minutes: 15
147147
steps:
148148
- name: Check out a copy of the git repository
149-
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
149+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
150150
with:
151151
fetch-depth: 0
152152

@@ -171,7 +171,7 @@ jobs:
171171
timeout-minutes: 15
172172
steps:
173173
- name: Check out a copy of the git repository
174-
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
174+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
175175
with:
176176
fetch-depth: 0
177177

@@ -195,13 +195,13 @@ jobs:
195195
timeout-minutes: 15
196196
steps:
197197
- name: Check out a copy of the git repository
198-
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
198+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
199199
with:
200200
fetch-depth: 0
201201

202202
- name: Run actionlint
203203
continue-on-error: ${{inputs.soft-linting == 'true'}}
204-
uses: raven-actions/actionlint@3a24062651993d40fed1019b58ac6fbdfbf276cc # v2
204+
uses: raven-actions/actionlint@e01d1ea33dd6a5ed517d95b4c0c357560ac6f518 # v2
205205
with:
206206
flags: ${{inputs.debug && '-verbose'}}
207207
files: '.github/workflows/*.{yaml,yml}'
@@ -234,12 +234,12 @@ jobs:
234234
- '3.13'
235235
steps:
236236
- name: Check out a copy of the git repository
237-
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
237+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
238238
with:
239239
submodules: recursive
240240

241241
- name: Set up Python
242-
uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v5
242+
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v5
243243
id: setup
244244
with:
245245
python-version: ${{matrix.python_version}}
@@ -326,12 +326,12 @@ jobs:
326326
parallel_opt: [openmp, nopenmp]
327327
steps:
328328
- name: Check out a copy of the git repository
329-
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
329+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
330330
with:
331331
submodules: recursive
332332

333333
- name: Set up Python
334-
uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v5
334+
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v5
335335
with:
336336
python-version: ${{env.python-version}}
337337
cache: pip
@@ -385,12 +385,12 @@ jobs:
385385
tests:all
386386
steps:
387387
- name: Check out a copy of the git repository
388-
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
388+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
389389
with:
390390
submodules: recursive
391391

392392
- name: Set up Python
393-
uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v5
393+
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v5
394394
with:
395395
python-version: ${{env.python-version}}
396396
cache: pip
@@ -441,7 +441,7 @@ jobs:
441441
BUILDKIT_PROGRESS: ${{inputs.debug && 'plain'}}
442442
steps:
443443
- name: Check out a copy of the git repository
444-
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
444+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
445445
with:
446446
submodules: recursive
447447

.github/workflows/cirq_compatibility.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,13 @@ jobs:
4141
timeout-minutes: 30
4242
steps:
4343
- name: Check out a copy of the git repository
44-
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
44+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
4545
with:
4646
fetch-depth: 1
4747
submodules: recursive
4848

4949
- name: Set up Python with caching of pip dependencies
50-
uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v5
50+
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v5
5151
with:
5252
python-version: '3.12'
5353
cache: pip
@@ -63,5 +63,5 @@ jobs:
6363

6464
- name: Run Python tests
6565
env:
66-
PYTEST_ADDOPTS: ${{inputs.debug && '-v' || '' }}
66+
PYTEST_ADDOPTS: ${{inputs.debug && '-n auto -v' || '-n auto' }}
6767
run: make -j run-py-tests

.github/workflows/pr-labeler.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ jobs:
6161
SHELLOPTS: ${{inputs.debug && 'xtrace' || '' }}
6262
steps:
6363
- name: Check out a copy of the git repository
64-
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
64+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
6565
with:
6666
sparse-checkout: |
6767
./dev_tools/ci/size-labeler.sh

.github/workflows/scorecard-scanner.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ jobs:
5757
timeout-minutes: 15
5858
steps:
5959
- name: Check out a copy of the git repository
60-
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
60+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
6161
with:
6262
persist-credentials: false
6363

@@ -80,7 +80,7 @@ jobs:
8080
- if: github.event.inputs.debug == true || runner.debug == true
8181
name: Upload results as artifacts to the workflow Summary page
8282
# yamllint disable rule:line-length
83-
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
83+
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
8484
with:
8585
name: Scorecard SARIF file
8686
path: scorecard-results.sarif

.gitignore

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,39 +26,62 @@ eigen/
2626
ipython_config.py
2727

2828
# Python-related items.
29+
*$py.class
30+
*.cover
2931
*.coverage
3032
*.coverage.*
3133
*.egg
3234
*.egg-info/
3335
*.py,cover
3436
*.py[cod]
37+
*.whl
3538
.cache/
3639
.dmypy.json
3740
.mypy_cache/
41+
.nox/
3842
.pytest_cache/
43+
.python-version
3944
.pytype/
4045
.ruff_cache/
46+
.tox/
4147
__pycache__/
4248
build/
49+
coverage.xml
4350
dist/
4451
dmypy.json
52+
sdist/
4553
wheelhouse/
4654

4755
# Python virtual environments (from instructions given to people).
48-
CirqDevEnv
49-
venv
56+
CirqDevEnv/
57+
venv/
5058

51-
# Generated files.
52-
*.o
59+
# Don't commit local PyPI config files.
60+
.pypirc
61+
62+
# From pytest-benchmark.
63+
*.benchmarks/
64+
65+
# Default pycharm virtual env.
66+
.venv/
67+
68+
# Generated C/C++ files and libraries.
5369
*.a
70+
*.mod
71+
*.o
5472
*.so
5573
*.x
56-
*.mod
74+
75+
# Executables
76+
*.exe
77+
*.out
5778

5879
# Miscellaneous common editor backup files and temp files.
5980
*.bak
81+
*.log
6082
*.swp
6183
*.tmp
84+
*.~*~
6285
*~
6386
.\#*
6487
.idea/

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ ifeq ($(PYBIND11), true)
3030
endif
3131

3232
# Default options for Pytest (only used if the pybind interface is built).
33-
PYTESTFLAGS ?= -v
33+
PYTESTFLAGS ?= -n auto -v
3434

3535
# Default compilers and compiler flags.
3636
# Can be overriden via env variables or command-line flags.

apps/qsim_base_custatevecex.cu

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,18 +32,19 @@ struct Options {
3232
std::string circuit_file;
3333
unsigned maxtime = std::numeric_limits<unsigned>::max();
3434
unsigned seed = 1;
35+
unsigned lbuf = 30;
3536
unsigned verbosity = 0;
3637
};
3738

3839
Options GetOptions(int argc, char* argv[]) {
39-
constexpr char usage[] = "usage:\n ./qsim_base -c circuit -d maxtime "
40-
"-s seed -v verbosity\n";
40+
constexpr char usage[] = "usage:\n ./qsim_base_custatevecex.x -c circuit "
41+
"-d maxtime -s seed -l lbuf -v verbosity\n";
4142

4243
Options opt;
4344

4445
int k;
4546

46-
while ((k = getopt(argc, argv, "c:d:s:v:")) != -1) {
47+
while ((k = getopt(argc, argv, "c:d:s:l:v:")) != -1) {
4748
switch (k) {
4849
case 'c':
4950
opt.circuit_file = optarg;
@@ -54,6 +55,9 @@ Options GetOptions(int argc, char* argv[]) {
5455
case 's':
5556
opt.seed = std::atoi(optarg);
5657
break;
58+
case 'l':
59+
opt.lbuf = std::atoi(optarg);
60+
break;
5761
case 'v':
5862
opt.verbosity = std::atoi(optarg);
5963
break;
@@ -112,8 +116,14 @@ int main(int argc, char* argv[]) {
112116
using Simulator = qsim::SimulatorCuStateVecEx<fp_type>;
113117
using StateSpace = Simulator::StateSpace;
114118

115-
explicit Factory(unsigned verbosity = 0) : verbosity(verbosity) {
116-
mp.initialize();
119+
explicit Factory(uint64_t transfer_buffer_size, unsigned verbosity = 0)
120+
: verbosity(verbosity) {
121+
MultiProcessCuStateVecEx::Parameter param = {transfer_buffer_size};
122+
mp.Initialize(param);
123+
124+
if (verbosity > 2 && mp.Initialized()) {
125+
qsim::IO::messagef("# transfer_buf_size=%lu\n", transfer_buffer_size);
126+
}
117127
}
118128

119129
StateSpace CreateStateSpace() const {
@@ -136,7 +146,7 @@ int main(int argc, char* argv[]) {
136146
using State = StateSpace::State;
137147
using Runner = CuStateVecExRunner<IO, Factory>;
138148

139-
Factory factory(opt.verbosity);
149+
Factory factory(uint64_t{1} << opt.lbuf, opt.verbosity);
140150

141151
StateSpace state_space = factory.CreateStateSpace();
142152
State state = state_space.Create(circuit.num_qubits);

0 commit comments

Comments
 (0)