Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dca_mini_apps
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
NDIP
Tool Sources
DCA
dca_mini_apps
Commits
43c5016e
Commit
43c5016e
authored
2 years ago
by
Qian Gong
Browse files
Options
Downloads
Patches
Plain Diff
add data re-org code
parent
2d6c0473
Branches
ml_dca
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
load_G_k_w.py
+59
-0
59 additions, 0 deletions
load_G_k_w.py
with
59 additions
and
0 deletions
load_G_k_w.py
0 → 100644
+
59
−
0
View file @
43c5016e
import
sys
sys
.
path
.
append
(
'
/ccs/home/gongq/andes/indir/lib/python3.7/site-packages/adios2/
'
)
import
adios2
as
ad2
import
numpy
as
np
n_meas
=
10000
# 50000
n_rank
=
10
n_walk
=
1
num_Gw
=
n_meas
*
n_rank
*
n_walk
# read G_k_w from single_meas_G.bp
G_k_w
=
np
.
zeros
((
num_Gw
,
2
,
1024
),
dtype
=
'
complex128
'
)
# spins, times
vertexConf
=
np
.
zeros
((
num_Gw
,
2
,
1024
),
dtype
=
'
float64
'
)
log_w
=
np
.
zeros
(
num_Gw
,
dtype
=
'
float64
'
)
k
=
np
.
zeros
(
num_Gw
,
dtype
=
'
int32
'
)
k_max
=
1
#Mfun = np.zeros((num_Gw, 2, 1024), dtype='complex128')
# filename = '/gpfs/alpine/world-shared/cph102/epd/single_meas_G_additional_dens1.bp'
#filename = '/gpfs/alpine/world-shared/cph102/epd/single_meas_G_2_500K_additional_dens1/single_meas_G_2_250K_additional_dens1.bp'
filename
=
'
/gpfs/alpine/world-shared/cph102/epd/single_meas_G_100B_100k_5.bp
'
with
ad2
.
open
(
filename
,
'
r
'
)
as
fh
:
for
i
in
range
(
1
,
n_meas
+
1
):
p
=
i
*
(
n_rank
*
n_walk
)
for
j
in
range
(
n_rank
):
q
=
j
*
n_walk
for
walks
in
range
(
n_walk
):
# MFunction = fh.read('/STQW_Configurations/r_'+str(j)+'_meas_'+str(i)+'_w_'+str(walks)+'/MFunction')
Gw
=
fh
.
read
(
'
/STQW_Configurations/r_
'
+
str
(
j
)
+
'
_meas_
'
+
str
(
i
)
+
'
_w_
'
+
str
(
walks
)
+
'
/G_k_w
'
)
config
=
fh
.
read
(
'
/STQW_Configurations/r_
'
+
str
(
j
)
+
'
_meas_
'
+
str
(
i
)
+
'
_w_
'
+
str
(
walks
)
+
'
/times
'
)
spins
=
fh
.
read
(
'
/STQW_Configurations/r_
'
+
str
(
j
)
+
'
_meas_
'
+
str
(
i
)
+
'
_w_
'
+
str
(
walks
)
+
'
/spins
'
)
idx
=
p
+
q
+
walks
-
n_rank
*
n_walk
# Mfun[idx, 0, :] = MFunction[:, 0, 0, 0, 0, 0]
# Mfun[idx, 1, :] = MFunction[:, 0, 1, 0, 1, 0]
# print('/STQW_Configurations/r_'+str(j)+'_meas_'+str(i)+'_w_'+str(k)+'/times')
# print(Gw.shape, config.shape)
print
(
i
,
j
,
idx
,
Gw
.
shape
)
k
[
idx
]
=
config
.
shape
[
0
]
k_max
=
max
(
k
[
idx
],
k_max
)
vertexConf
[
idx
,
0
,
:
k
[
idx
]]
=
config
vertexConf
[
idx
,
1
,
:
k
[
idx
]]
=
spins
log_w
[
idx
]
=
fh
.
read
(
'
/STQW_Configurations/r_
'
+
str
(
j
)
+
'
_meas_
'
+
str
(
i
)
+
'
_w_
'
+
str
(
walks
)
+
'
/log-weight
'
)
G_k_w
[
idx
,
0
,:]
=
Gw
[:,
0
,
0
,
0
,
0
,
0
]
G_k_w
[
idx
,
1
,:]
=
Gw
[:,
0
,
1
,
0
,
1
,
0
]
# print(idx, vertexConf[idx,:,:].max())
#Mfun.tofile('MFunction.txt')
#G_k_w.tofile('G_k_w.txt')
#log_w.tofile('log_weight.txt')
#k.tofile('vertext_k.txt')
#vertexConf.tofile('vertexConf.txt')
#print('max vertex: ', k.max())
with
ad2
.
open
(
'
single_meas_G_100B_100k_5.bp
'
,
'
w
'
)
as
fh
:
fh
.
write
(
"
vertexConf
"
,
np
.
ascontiguousarray
(
vertexConf
.
flatten
(),
dtype
=
np
.
float64
),
vertexConf
.
shape
,
[
0
,
0
,
0
],
vertexConf
.
shape
)
fh
.
write
(
"
G_wn
"
,
np
.
ascontiguousarray
(
G_k_w
.
flatten
(),
dtype
=
np
.
complex128
),
G_k_w
.
shape
,
[
0
,
0
,
0
],
G_k_w
.
shape
)
# fh.write("M_wn", np.ascontiguousarray(Mfun.flatten(), dtype=np.complex128), Mfun.shape, [0, 0, 0], Mfun.shape)
fh
.
write
(
"
k
"
,
np
.
ascontiguousarray
(
k
.
flatten
()
,
dtype
=
np
.
int32
),
[
num_Gw
],
[
0
],
[
num_Gw
])
fh
.
write
(
"
log_w
"
,
np
.
ascontiguousarray
(
log_w
.
flatten
()
,
dtype
=
np
.
int32
),
[
num_Gw
],
[
0
],
[
num_Gw
])
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment