mirror of
https://github.com/paboyle/Grid.git
synced 2026-09-30 21:18:05 +01:00
Compare commits
472
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9bfd641b22 | ||
|
|
be40aaf751 | ||
|
|
e069fd5ed8 | ||
|
|
b46d31d4b6 | ||
|
|
7c57cac670 | ||
|
|
888ebc3cf9 | ||
|
|
6c031a1b81 | ||
|
|
02aa4bd762 | ||
|
|
9aafa8ee60 | ||
|
|
430b98b354 | ||
|
|
84189867ef | ||
|
|
4ab8cfbe2a | ||
|
|
aadd9f4468 | ||
|
|
8fbb27ce13 | ||
|
|
21bba95909 | ||
|
|
6448fe7121 | ||
|
|
2458a11d1d | ||
|
|
d0ca7c3fe6 | ||
|
|
57f899d79c | ||
|
|
e881a0c157 | ||
|
|
f411657118 | ||
|
|
7458c6174b | ||
|
|
21b269d0f9 | ||
|
|
083af92ac2 | ||
|
|
2c162577b5 | ||
|
|
b1c4e96382 | ||
|
|
a55c6f34f3 | ||
|
|
beed527ea3 | ||
|
|
eaa633cf69 | ||
|
|
c632455129 | ||
|
|
c012899ed5 | ||
|
|
8bab544c2f | ||
|
|
76fc06a5dc | ||
|
|
4af6c7e7aa | ||
|
|
f60fbcfc4d | ||
|
|
464c81706e | ||
|
|
408130b808 | ||
|
|
375edd1370 | ||
|
|
6d912f6c67 | ||
|
|
6d1d28955e | ||
|
|
920b471761 | ||
|
|
63c21767ba | ||
|
|
7b6b712565 | ||
|
|
35abd05ee9 | ||
|
|
dd36e60f6a | ||
|
|
cb6c548e21 | ||
|
|
02c4ccf621 | ||
|
|
fd24588212 | ||
|
|
b800bb3ecb | ||
|
|
f8abd0978b | ||
|
|
12c7c493bf | ||
|
|
c7c9072313 | ||
|
|
2bf3be5fae | ||
|
|
3a40e4fc69 | ||
|
|
2e69e03f6f | ||
|
|
a09f9bb528 | ||
|
|
f0e341d726 | ||
|
|
6f09df0daf | ||
|
|
26cee605b8 | ||
|
|
b3fa18c229 | ||
|
|
2940c9bcfd | ||
|
|
0bb532f72b | ||
|
|
fada2aa0f7 | ||
|
|
c193e4e675 | ||
|
|
3ee682f676 | ||
|
|
d85ec3bac2 | ||
|
|
b52d8eb1e3 | ||
|
|
ee630d2e8b | ||
|
|
2f0af79869 | ||
|
|
1b7fb79ec0 | ||
|
|
2db1a4628c | ||
|
|
6aa047d842 | ||
|
|
8779c32ae1 | ||
|
|
c527dc3358 | ||
|
|
6b42577b6b | ||
|
|
fb3596f968 | ||
|
|
f3a0158213 | ||
|
|
0250aa9347 | ||
|
|
3df6743396 | ||
|
|
fb7d021b9d | ||
|
|
5f206df775 | ||
|
|
7727e81113 | ||
|
|
c4115544a5 | ||
|
|
08c47328ba | ||
|
|
09001aedca | ||
|
|
2c67304716 | ||
|
|
dc6d8686de | ||
|
|
cc2780bea3 | ||
|
|
6e5a2b7922 | ||
|
|
f4878d3a13 | ||
|
|
89d2fac92e | ||
|
|
f2d3e41cf2 | ||
|
|
3c27bb36d4 | ||
|
|
603d59f389 | ||
|
|
07a0ef3f95 | ||
|
|
503259f9c9 | ||
|
|
5be6a51044 | ||
|
|
ac69f042b1 | ||
|
|
133d5c2e34 | ||
|
|
2a94244890 | ||
|
|
a15a2dfd29 | ||
|
|
093bb02633 | ||
|
|
99a85116f8 | ||
|
|
27cdb79063 | ||
|
|
f4cbfd63ff | ||
|
|
2b794b6aa7 | ||
|
|
d0244a059f | ||
|
|
dcdd891d7d | ||
|
|
6d2df9de79 | ||
|
|
41d4e37bae | ||
|
|
ee5c0cc9b6 | ||
|
|
0a4020eb4d | ||
|
|
b2de26589b | ||
|
|
0677adb4dd | ||
|
|
231cc95be6 | ||
|
|
639f9cab82 | ||
|
|
4eac4e575e | ||
|
|
3f0f92cda6 | ||
|
|
d2650e89bd | ||
|
|
2962123cba | ||
|
|
830168ec37 | ||
|
|
584c921ca0 | ||
|
|
81347b4d16 | ||
|
|
2cfa0b0e6b | ||
|
|
fa5dee76b1 | ||
|
|
8d1679c6b8 | ||
|
|
3791a38f7c | ||
|
|
142f7b0c86 | ||
|
|
891ad66eab | ||
|
|
60c43151c5 | ||
|
|
e036800261 | ||
|
|
62900def36 | ||
|
|
e3a309a73f | ||
|
|
ad6c1c0c4e | ||
|
|
00b92a91b5 | ||
|
|
65533741f7 | ||
|
|
dc0259fbda | ||
|
|
131a6785d4 | ||
|
|
44f4f5c8e2 | ||
|
|
2679df034f | ||
|
|
bf71162b97 | ||
|
|
299e828d83 | ||
|
|
ef5452cddf | ||
|
|
80de748737 | ||
|
|
71e1006ba8 | ||
|
|
00f31ae83f | ||
|
|
cce339deaf | ||
|
|
24128ff109 | ||
|
|
34e9d3f0ca | ||
|
|
c995788259 | ||
|
|
94c7198001 | ||
|
|
04d86fe9f3 | ||
|
|
b78074b6a0 | ||
|
|
7dfd3cdae8 | ||
|
|
cecee1ef2c | ||
|
|
355d4b58be | ||
|
|
2c54a536f3 | ||
|
|
d868a45120 | ||
|
|
9deae8c962 | ||
|
|
db86cdd7bd | ||
|
|
ec9939c1ba | ||
|
|
f74617c124 | ||
|
|
8c6a3921ed | ||
|
|
a8a15dd9d0 | ||
|
|
3ce68a751a | ||
|
|
daa0977d01 | ||
|
|
a2929f4384 | ||
|
|
7fe3974c0a | ||
|
|
f7e86f81a0 | ||
|
|
fecec803d9 | ||
|
|
8fe9a13cdd | ||
|
|
d2c42e6f42 | ||
|
|
049cc518f4 | ||
|
|
2e1c66897f | ||
|
|
adcef36189 | ||
|
|
2f121c41c9 | ||
|
|
e0ed7e300f | ||
|
|
485207901b | ||
|
|
c760f0a4c3 | ||
|
|
c84eeedec3 | ||
|
|
1ac3526f33 | ||
|
|
0de090ee74 | ||
|
|
91405de3f7 | ||
|
|
8fccda301a | ||
|
|
7a0abfac89 | ||
|
|
ae37fda699 | ||
|
|
b5fc5e2030 | ||
|
|
8db0ef9736 | ||
|
|
95d4b46446 | ||
|
|
5dfd216a34 | ||
|
|
c2e8d0aa88 | ||
|
|
0fe5aeffbb | ||
|
|
7fbc469046 | ||
|
|
bf96a4bdbf | ||
|
|
84685c9bc3 | ||
|
|
a8d4156997 | ||
|
|
c18074869b | ||
|
|
f4c6d39238 | ||
|
|
200d35b38a | ||
|
|
eb52e84d09 | ||
|
|
72abc34764 | ||
|
|
e3164d4c7b | ||
|
|
f5db386c55 | ||
|
|
294ee70a7a | ||
|
|
013ea4e8d1 | ||
|
|
7fbbb31a50 | ||
|
|
0e127b1fc7 | ||
|
|
68c028b0a6 | ||
|
|
255d4992e1 | ||
|
|
a0d399e5ce | ||
|
|
fd3b2e945a | ||
|
|
b999984501 | ||
|
|
7836cc2d74 | ||
|
|
a61e0df54b | ||
|
|
9d835afa35 | ||
|
|
5e3be47117 | ||
|
|
48de706dd5 | ||
|
|
f871fb0c6d | ||
|
|
93771f3099 | ||
|
|
8cb205725b | ||
|
|
9ad580d82f | ||
|
|
899f961d0d | ||
|
|
54d789204f | ||
|
|
25828746f3 | ||
|
|
f362c00739 | ||
|
|
25d1cadd3b | ||
|
|
c24d53bbd1 | ||
|
|
2017e4e3b4 | ||
|
|
27a4d4c951 | ||
|
|
2f92721249 | ||
|
|
3c7a4106ed | ||
|
|
3252059daf | ||
|
|
6eed167f0c | ||
|
|
4ad0df6fde | ||
|
|
661381e881 | ||
|
|
68a5079f33 | ||
|
|
8634e19f1b | ||
|
|
9ada378e38 | ||
|
|
9d9692d439 | ||
|
|
0659ae4014 | ||
|
|
bfbf2f1fa0 | ||
|
|
dd6b796a01 | ||
|
|
52a856b4a8 | ||
|
|
04190ee7f3 | ||
|
|
587bfcc0f4 | ||
|
|
2700992ef5 | ||
|
|
8c658de179 | ||
|
|
ba37d51ee9 | ||
|
|
4f4181c54a | ||
|
|
4d4ac2517b | ||
|
|
e568c24d1d | ||
|
|
b458326744 | ||
|
|
6e7d5e2243 | ||
|
|
b35169f1dd | ||
|
|
441ad7498d | ||
|
|
6f6c5c549a | ||
|
|
1584e17b54 | ||
|
|
12982a4455 | ||
|
|
172f412102 | ||
|
|
a64497265d | ||
|
|
ca639c195f | ||
|
|
edc28dcfbf | ||
|
|
c45f24a1b5 | ||
|
|
aaf37ee4d7 | ||
|
|
1dddd17e3c | ||
|
|
661f1d3e8e | ||
|
|
edcf9b9293 | ||
|
|
49b8501fd4 | ||
|
|
d47484717e | ||
|
|
96272f3841 | ||
|
|
5c936d88a0 | ||
|
|
1c64ee926e | ||
|
|
2cbb72a81c | ||
|
|
31d83ee046 | ||
|
|
a9e8758a01 | ||
|
|
3e125c5b61 | ||
|
|
eac6ec4b5e | ||
|
|
213f8db6a2 | ||
|
|
cc6eb51e3e | ||
|
|
507009089b | ||
|
|
b234784c8e | ||
|
|
6ea2a8b7ca | ||
|
|
c1d0359aaa | ||
|
|
047ee4ad0b | ||
|
|
a13106da0c | ||
|
|
75113e6523 | ||
|
|
325c73d051 | ||
|
|
b25a59e95e | ||
|
|
7c4533797f | ||
|
|
af84fd65bb | ||
|
|
1a2613086a | ||
|
|
4f110c09a5 | ||
|
|
6764362237 | ||
|
|
2fa2b0e0b1 | ||
|
|
b61292f735 | ||
|
|
ce7720e221 | ||
|
|
853a5528dc | ||
|
|
169f405c9c | ||
|
|
c6125b01ce | ||
|
|
b0b5b34bff | ||
|
|
1c9722357d | ||
|
|
334da7f452 | ||
|
|
4669ecd4ba | ||
|
|
4573b34cac | ||
|
|
17f57e85d1 | ||
|
|
17f27b1ebd | ||
|
|
a16bbecb8a | ||
|
|
7c9b0dd842 | ||
|
|
6b7228b3e6 | ||
|
|
f117552334 | ||
|
|
a21a160029 | ||
|
|
6b8ffbe735 | ||
|
|
81050535a5 | ||
|
|
7dcf5c90e3 | ||
|
|
9ce00f26f9 | ||
|
|
85c253ed4a | ||
|
|
ccfc0a5a89 | ||
|
|
d3f857b1c9 | ||
|
|
fb62035aa0 | ||
|
|
0260bc7705 | ||
|
|
68e6a58f12 | ||
|
|
640515e3d8 | ||
|
|
97c579f637 | ||
|
|
a4d8512fb8 | ||
|
|
5ec903044d | ||
|
|
8a0cf0194f | ||
|
|
1c680d4b7a | ||
|
|
e9323460c7 | ||
|
|
58c2f60b69 | ||
|
|
bfa3a7b3b0 | ||
|
|
f212b0a963 | ||
|
|
62702dbcb8 | ||
|
|
41d6cab033 | ||
|
|
5a31e747c9 | ||
|
|
cbc73a3fd1 | ||
|
|
d516938707 | ||
|
|
72344d1418 | ||
|
|
7ecf6ab38b | ||
|
|
2d4d70d3ec | ||
|
|
78f8d47528 | ||
|
|
b85f987b0b | ||
|
|
f57afe2079 | ||
|
|
8462bbfe63 | ||
|
|
229977c955 | ||
|
|
e485a07133 | ||
|
|
70ec2faa98 | ||
|
|
2f849ee252 | ||
|
|
bb6ed44339 | ||
|
|
80302e95a8 | ||
|
|
9942723189 | ||
|
|
b938202081 | ||
|
|
e79ef469ac | ||
|
|
c793947209 | ||
|
|
3e9ee053a1 | ||
|
|
dda6c69d5b | ||
|
|
cd51b9af99 | ||
|
|
f32555dcc5 | ||
|
|
e93c883470 | ||
|
|
fcac5c0772 | ||
|
|
90f4000935 | ||
|
|
480708b9a0 | ||
|
|
c4baf876d4 | ||
|
|
2f4dac3531 | ||
|
|
3ec6890850 | ||
|
|
018801d973 | ||
|
|
1d83521daa | ||
|
|
fc5670c6a4 | ||
|
|
d9c435e282 | ||
|
|
614a0e8277 | ||
|
|
aaf39222c3 | ||
|
|
550142bd6a | ||
|
|
c0a929aef7 | ||
|
|
37fe944224 | ||
|
|
315a42843f | ||
|
|
83a101db83 | ||
|
|
c4274e1660 | ||
|
|
ba6db55cb0 | ||
|
|
e5ea84d531 | ||
|
|
15767a1491 | ||
|
|
4d2a32ae7a | ||
|
|
5b937e3644 | ||
|
|
e418b044f7 | ||
|
|
b8b05f143f | ||
|
|
6ec42b4b82 | ||
|
|
abb7d4d2f5 | ||
|
|
16ebbfff29 | ||
|
|
4828226095 | ||
|
|
8a049f27b8 | ||
|
|
43578a3eb4 | ||
|
|
fdbd42e542 | ||
|
|
e7e4cee4f3 | ||
|
|
ec3954ff5f | ||
|
|
0f468e2179 | ||
|
|
8e61286741 | ||
|
|
69e4ecc1d2 | ||
|
|
5f483df16b | ||
|
|
4680a977c3 | ||
|
|
de42456171 | ||
|
|
d55212c998 | ||
|
|
c6e1f64573 | ||
|
|
724cf02d4a | ||
|
|
49a0ae73eb | ||
|
|
315f1146cd | ||
|
|
9f202782c5 | ||
|
|
594a262dcc | ||
|
|
7f8ca54285 | ||
|
|
c5b23c367e | ||
|
|
b6fe03eb26 | ||
|
|
f37ed4958b | ||
|
|
5f85473d6b | ||
|
|
ac3b0ebc58 | ||
|
|
4e0cf0cc28 | ||
|
|
cdf550845f | ||
|
|
3db7a5387b | ||
|
|
90dffc73c8 | ||
|
|
a1151fc734 | ||
|
|
ab3baeb38f | ||
|
|
389731d373 | ||
|
|
97b9c6f03d | ||
|
|
63982819c6 | ||
|
|
6fec507bef | ||
|
|
219b3bd34f | ||
|
|
24162c9ead | ||
|
|
935cd1e173 | ||
|
|
55e39df30f | ||
|
|
581be32ed2 | ||
|
|
6bc136b1d0 | ||
|
|
0c668bf46a | ||
|
|
840814c776 | ||
|
|
95af55128e | ||
|
|
9f2a57e334 | ||
|
|
c645d33db5 | ||
|
|
e0f1349524 | ||
|
|
79b761f923 | ||
|
|
0d4e31ca58 | ||
|
|
b07a354a33 | ||
|
|
c433939795 | ||
|
|
b6a4c31b48 | ||
|
|
98b1439ff9 | ||
|
|
564738b1ff | ||
|
|
a80e43dbcf | ||
|
|
b99622d9fb | ||
|
|
937c77ead2 | ||
|
|
95e5a2ade3 | ||
|
|
91676d1dda | ||
|
|
ac3611bb19 | ||
|
|
cc4afb978d | ||
|
|
20e92a7009 | ||
|
|
42f0afcbfa | ||
|
|
20ac13fdf3 | ||
|
|
e38612e6fa | ||
|
|
c2b2b71c5d | ||
|
|
009f48a904 | ||
|
|
5cfc0180aa | ||
|
|
914f180fa3 | ||
|
|
6cb563a40c | ||
|
|
db3837be22 | ||
|
|
2f0dd83016 | ||
|
|
3ac27e5596 | ||
|
|
bd466a55a8 | ||
|
|
c8e6f58e24 | ||
|
|
888988ad37 | ||
|
|
e4a105a30b | ||
|
|
26ebe41fef | ||
|
|
1e496fee74 | ||
|
|
9f755e0379 | ||
|
|
4512dbdf58 | ||
|
|
483fd3cfa1 | ||
|
|
85516e9c7c | ||
|
|
0c006fbfaa | ||
|
|
54c10a42cc | ||
|
|
ef0fe2bcc1 |
No files matched your search
+5
-21
@@ -83,6 +83,7 @@ ltmain.sh
|
|||||||
.Trashes
|
.Trashes
|
||||||
ehthumbs.db
|
ehthumbs.db
|
||||||
Thumbs.db
|
Thumbs.db
|
||||||
|
.dirstamp
|
||||||
|
|
||||||
# build directory #
|
# build directory #
|
||||||
###################
|
###################
|
||||||
@@ -97,11 +98,8 @@ build.sh
|
|||||||
|
|
||||||
# Eigen source #
|
# Eigen source #
|
||||||
################
|
################
|
||||||
lib/Eigen/*
|
Grid/Eigen
|
||||||
|
Eigen/*
|
||||||
# FFTW source #
|
|
||||||
################
|
|
||||||
lib/fftw/*
|
|
||||||
|
|
||||||
# libtool macros #
|
# libtool macros #
|
||||||
##################
|
##################
|
||||||
@@ -112,21 +110,7 @@ m4/libtool.m4
|
|||||||
################
|
################
|
||||||
gh-pages/
|
gh-pages/
|
||||||
|
|
||||||
# Buck files #
|
|
||||||
##############
|
|
||||||
.buck*
|
|
||||||
buck-out
|
|
||||||
BUCK
|
|
||||||
make-bin-BUCK.sh
|
|
||||||
|
|
||||||
# generated sources #
|
# generated sources #
|
||||||
#####################
|
#####################
|
||||||
lib/qcd/spin/gamma-gen/*.h
|
Grid/qcd/spin/gamma-gen/*.h
|
||||||
lib/qcd/spin/gamma-gen/*.cc
|
Grid/qcd/spin/gamma-gen/*.cc
|
||||||
lib/version.h
|
|
||||||
|
|
||||||
# vs code editor files #
|
|
||||||
########################
|
|
||||||
.vscode/
|
|
||||||
.vscode/settings.json
|
|
||||||
settings.json
|
|
||||||
+20
-6
@@ -9,6 +9,11 @@ matrix:
|
|||||||
- os: osx
|
- os: osx
|
||||||
osx_image: xcode8.3
|
osx_image: xcode8.3
|
||||||
compiler: clang
|
compiler: clang
|
||||||
|
env: PREC=single
|
||||||
|
- os: osx
|
||||||
|
osx_image: xcode8.3
|
||||||
|
compiler: clang
|
||||||
|
env: PREC=double
|
||||||
|
|
||||||
before_install:
|
before_install:
|
||||||
- export GRIDDIR=`pwd`
|
- export GRIDDIR=`pwd`
|
||||||
@@ -16,9 +21,11 @@ before_install:
|
|||||||
- if [[ "$TRAVIS_OS_NAME" == "linux" ]] && [[ "$CC" == "clang" ]]; then export PATH="${GRIDDIR}/clang/bin:${PATH}"; fi
|
- if [[ "$TRAVIS_OS_NAME" == "linux" ]] && [[ "$CC" == "clang" ]]; then export PATH="${GRIDDIR}/clang/bin:${PATH}"; fi
|
||||||
- if [[ "$TRAVIS_OS_NAME" == "linux" ]] && [[ "$CC" == "clang" ]]; then export LD_LIBRARY_PATH="${GRIDDIR}/clang/lib:${LD_LIBRARY_PATH}"; fi
|
- if [[ "$TRAVIS_OS_NAME" == "linux" ]] && [[ "$CC" == "clang" ]]; then export LD_LIBRARY_PATH="${GRIDDIR}/clang/lib:${LD_LIBRARY_PATH}"; fi
|
||||||
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update; fi
|
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update; fi
|
||||||
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install libmpc; fi
|
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install libmpc openssl; fi
|
||||||
|
|
||||||
install:
|
install:
|
||||||
|
- export CWD=`pwd`
|
||||||
|
- echo $CWD
|
||||||
- export CC=$CC$VERSION
|
- export CC=$CC$VERSION
|
||||||
- export CXX=$CXX$VERSION
|
- export CXX=$CXX$VERSION
|
||||||
- echo $PATH
|
- echo $PATH
|
||||||
@@ -31,17 +38,24 @@ install:
|
|||||||
- which $CXX
|
- which $CXX
|
||||||
- $CXX --version
|
- $CXX --version
|
||||||
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then export LDFLAGS='-L/usr/local/lib'; fi
|
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then export LDFLAGS='-L/usr/local/lib'; fi
|
||||||
|
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then export EXTRACONF='--with-openssl=/usr/local/opt/openssl'; fi
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- ./bootstrap.sh
|
- ./bootstrap.sh
|
||||||
- mkdir build
|
- mkdir build
|
||||||
- cd build
|
- cd build
|
||||||
- ../configure --enable-precision=single --enable-simd=SSE4 --enable-comms=none
|
- mkdir lime
|
||||||
|
- cd lime
|
||||||
|
- mkdir build
|
||||||
|
- cd build
|
||||||
|
- wget http://usqcd-software.github.io/downloads/c-lime/lime-1.3.2.tar.gz
|
||||||
|
- tar xf lime-1.3.2.tar.gz
|
||||||
|
- cd lime-1.3.2
|
||||||
|
- ./configure --prefix=$CWD/build/lime/install
|
||||||
- make -j4
|
- make -j4
|
||||||
- ./benchmarks/Benchmark_dwf --threads 1 --debug-signals
|
- make install
|
||||||
- echo make clean
|
- cd $CWD/build
|
||||||
- ../configure --enable-precision=double --enable-simd=SSE4 --enable-comms=none
|
- ../configure --enable-precision=$PREC --enable-simd=SSE4 --enable-comms=none --with-lime=$CWD/build/lime/install ${EXTRACONF}
|
||||||
- make -j4
|
- make -j4
|
||||||
- ./benchmarks/Benchmark_dwf --threads 1 --debug-signals
|
- ./benchmarks/Benchmark_dwf --threads 1 --debug-signals
|
||||||
- make check
|
- make check
|
||||||
|
|
||||||
File renamed without changes.
File renamed without changes.
@@ -48,6 +48,7 @@ Author: paboyle <paboyle@ph.ed.ac.uk>
|
|||||||
#include <Grid/serialisation/Serialisation.h>
|
#include <Grid/serialisation/Serialisation.h>
|
||||||
#include <Grid/threads/Threads.h>
|
#include <Grid/threads/Threads.h>
|
||||||
#include <Grid/util/Util.h>
|
#include <Grid/util/Util.h>
|
||||||
|
#include <Grid/util/Sha.h>
|
||||||
#include <Grid/communicator/Communicator.h>
|
#include <Grid/communicator/Communicator.h>
|
||||||
#include <Grid/cartesian/Cartesian.h>
|
#include <Grid/cartesian/Cartesian.h>
|
||||||
#include <Grid/tensors/Tensors.h>
|
#include <Grid/tensors/Tensors.h>
|
||||||
File renamed without changes.
File renamed without changes.
@@ -1,4 +1,9 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
// Force Eigen to use MKL if Grid has been configured with --enable-mkl
|
||||||
|
#ifdef USE_MKL
|
||||||
|
#define EIGEN_USE_MKL_ALL
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined __GNUC__
|
#if defined __GNUC__
|
||||||
#pragma GCC diagnostic push
|
#pragma GCC diagnostic push
|
||||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||||
@@ -21,6 +21,32 @@ if BUILD_HDF5
|
|||||||
extra_headers+=serialisation/Hdf5Type.h
|
extra_headers+=serialisation/Hdf5Type.h
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
all: version-cache
|
||||||
|
|
||||||
|
version-cache:
|
||||||
|
@if [ `git status --porcelain | grep -v '??' | wc -l` -gt 0 ]; then\
|
||||||
|
a="uncommited changes";\
|
||||||
|
else\
|
||||||
|
a="clean";\
|
||||||
|
fi;\
|
||||||
|
echo "`git log -n 1 --format=format:"#define GITHASH \\"%H:%d $$a\\"%n" HEAD`" > vertmp;\
|
||||||
|
if [ -e version-cache ]; then\
|
||||||
|
d=`diff vertmp version-cache`;\
|
||||||
|
if [ "$${d}" != "" ]; then\
|
||||||
|
mv vertmp version-cache;\
|
||||||
|
rm -f Version.h;\
|
||||||
|
fi;\
|
||||||
|
else\
|
||||||
|
mv vertmp version-cache;\
|
||||||
|
rm -f Version.h;\
|
||||||
|
fi;\
|
||||||
|
rm -f vertmp
|
||||||
|
|
||||||
|
Version.h:
|
||||||
|
cp version-cache Version.h
|
||||||
|
|
||||||
|
.PHONY: version-cache
|
||||||
|
|
||||||
#
|
#
|
||||||
# Libraries
|
# Libraries
|
||||||
#
|
#
|
||||||
@@ -30,8 +56,8 @@ include Eigen.inc
|
|||||||
lib_LIBRARIES = libGrid.a
|
lib_LIBRARIES = libGrid.a
|
||||||
|
|
||||||
CCFILES += $(extra_sources)
|
CCFILES += $(extra_sources)
|
||||||
HFILES += $(extra_headers)
|
HFILES += $(extra_headers) Config.h Version.h
|
||||||
|
|
||||||
libGrid_a_SOURCES = $(CCFILES)
|
libGrid_a_SOURCES = $(CCFILES)
|
||||||
libGrid_adir = $(pkgincludedir)
|
libGrid_adir = $(includedir)/Grid
|
||||||
nobase_dist_pkginclude_HEADERS = $(HFILES) $(eigen_files) Config.h
|
nobase_dist_pkginclude_HEADERS = $(HFILES) $(eigen_files) $(eigen_unsupp_files)
|
||||||
@@ -52,6 +52,7 @@ Author: Peter Boyle <paboyle@ph.ed.ac.uk>
|
|||||||
#include <Grid/algorithms/CoarsenedMatrix.h>
|
#include <Grid/algorithms/CoarsenedMatrix.h>
|
||||||
#include <Grid/algorithms/FFT.h>
|
#include <Grid/algorithms/FFT.h>
|
||||||
|
|
||||||
|
|
||||||
// EigCg
|
// EigCg
|
||||||
// Pcg
|
// Pcg
|
||||||
// Hdcg
|
// Hdcg
|
||||||
File renamed without changes.
File renamed without changes.
@@ -309,36 +309,59 @@ namespace Grid {
|
|||||||
class SchurStaggeredOperator : public SchurOperatorBase<Field> {
|
class SchurStaggeredOperator : public SchurOperatorBase<Field> {
|
||||||
protected:
|
protected:
|
||||||
Matrix &_Mat;
|
Matrix &_Mat;
|
||||||
|
Field tmp;
|
||||||
|
RealD mass;
|
||||||
|
double tMpc;
|
||||||
|
double tIP;
|
||||||
|
double tMeo;
|
||||||
|
double taxpby_norm;
|
||||||
|
uint64_t ncall;
|
||||||
public:
|
public:
|
||||||
SchurStaggeredOperator (Matrix &Mat): _Mat(Mat){};
|
void Report(void)
|
||||||
|
{
|
||||||
|
std::cout << GridLogMessage << " HermOpAndNorm.Mpc "<< tMpc/ncall<<" usec "<<std::endl;
|
||||||
|
std::cout << GridLogMessage << " HermOpAndNorm.IP "<< tIP /ncall<<" usec "<<std::endl;
|
||||||
|
std::cout << GridLogMessage << " Mpc.MeoMoe "<< tMeo/ncall<<" usec "<<std::endl;
|
||||||
|
std::cout << GridLogMessage << " Mpc.axpby_norm "<< taxpby_norm/ncall<<" usec "<<std::endl;
|
||||||
|
}
|
||||||
|
SchurStaggeredOperator (Matrix &Mat): _Mat(Mat), tmp(_Mat.RedBlackGrid())
|
||||||
|
{
|
||||||
|
assert( _Mat.isTrivialEE() );
|
||||||
|
mass = _Mat.Mass();
|
||||||
|
tMpc=0;
|
||||||
|
tIP =0;
|
||||||
|
tMeo=0;
|
||||||
|
taxpby_norm=0;
|
||||||
|
ncall=0;
|
||||||
|
}
|
||||||
virtual void HermOpAndNorm(const Field &in, Field &out,RealD &n1,RealD &n2){
|
virtual void HermOpAndNorm(const Field &in, Field &out,RealD &n1,RealD &n2){
|
||||||
GridLogIterative.TimingMode(1);
|
ncall++;
|
||||||
std::cout << GridLogIterative << " HermOpAndNorm "<<std::endl;
|
tMpc-=usecond();
|
||||||
n2 = Mpc(in,out);
|
n2 = Mpc(in,out);
|
||||||
std::cout << GridLogIterative << " HermOpAndNorm.Mpc "<<std::endl;
|
tMpc+=usecond();
|
||||||
|
tIP-=usecond();
|
||||||
ComplexD dot= innerProduct(in,out);
|
ComplexD dot= innerProduct(in,out);
|
||||||
std::cout << GridLogIterative << " HermOpAndNorm.innerProduct "<<std::endl;
|
tIP+=usecond();
|
||||||
n1 = real(dot);
|
n1 = real(dot);
|
||||||
}
|
}
|
||||||
virtual void HermOp(const Field &in, Field &out){
|
virtual void HermOp(const Field &in, Field &out){
|
||||||
std::cout << GridLogIterative << " HermOp "<<std::endl;
|
ncall++;
|
||||||
Mpc(in,out);
|
tMpc-=usecond();
|
||||||
|
_Mat.Meooe(in,out);
|
||||||
|
_Mat.Meooe(out,tmp);
|
||||||
|
tMpc+=usecond();
|
||||||
|
taxpby_norm-=usecond();
|
||||||
|
axpby(out,-1.0,mass*mass,tmp,in);
|
||||||
|
taxpby_norm+=usecond();
|
||||||
}
|
}
|
||||||
virtual RealD Mpc (const Field &in, Field &out) {
|
virtual RealD Mpc (const Field &in, Field &out) {
|
||||||
Field tmp(in._grid);
|
tMeo-=usecond();
|
||||||
Field tmp2(in._grid);
|
|
||||||
|
|
||||||
std::cout << GridLogIterative << " HermOp.Mpc "<<std::endl;
|
|
||||||
_Mat.Mooee(in,out);
|
|
||||||
_Mat.Mooee(out,tmp);
|
|
||||||
std::cout << GridLogIterative << " HermOp.MooeeMooee "<<std::endl;
|
|
||||||
|
|
||||||
_Mat.Meooe(in,out);
|
_Mat.Meooe(in,out);
|
||||||
_Mat.Meooe(out,tmp2);
|
_Mat.Meooe(out,tmp);
|
||||||
std::cout << GridLogIterative << " HermOp.MeooeMeooe "<<std::endl;
|
tMeo+=usecond();
|
||||||
|
taxpby_norm-=usecond();
|
||||||
RealD nn=axpy_norm(out,-1.0,tmp2,tmp);
|
RealD nn=axpby_norm(out,-1.0,mass*mass,tmp,in);
|
||||||
std::cout << GridLogIterative << " HermOp.axpy_norm "<<std::endl;
|
taxpby_norm+=usecond();
|
||||||
return nn;
|
return nn;
|
||||||
}
|
}
|
||||||
virtual RealD MpcDag (const Field &in, Field &out){
|
virtual RealD MpcDag (const Field &in, Field &out){
|
||||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+21
-12
@@ -54,6 +54,7 @@ class ConjugateGradient : public OperatorFunction<Field> {
|
|||||||
|
|
||||||
void operator()(LinearOperatorBase<Field> &Linop, const Field &src, Field &psi) {
|
void operator()(LinearOperatorBase<Field> &Linop, const Field &src, Field &psi) {
|
||||||
|
|
||||||
|
|
||||||
psi.checkerboard = src.checkerboard;
|
psi.checkerboard = src.checkerboard;
|
||||||
conformable(psi, src);
|
conformable(psi, src);
|
||||||
|
|
||||||
@@ -70,7 +71,6 @@ class ConjugateGradient : public OperatorFunction<Field> {
|
|||||||
|
|
||||||
Linop.HermOpAndNorm(psi, mmp, d, b);
|
Linop.HermOpAndNorm(psi, mmp, d, b);
|
||||||
|
|
||||||
|
|
||||||
r = src - mmp;
|
r = src - mmp;
|
||||||
p = r;
|
p = r;
|
||||||
|
|
||||||
@@ -96,38 +96,44 @@ class ConjugateGradient : public OperatorFunction<Field> {
|
|||||||
<< "ConjugateGradient: k=0 residual " << cp << " target " << rsq << std::endl;
|
<< "ConjugateGradient: k=0 residual " << cp << " target " << rsq << std::endl;
|
||||||
|
|
||||||
GridStopWatch LinalgTimer;
|
GridStopWatch LinalgTimer;
|
||||||
|
GridStopWatch InnerTimer;
|
||||||
|
GridStopWatch AxpyNormTimer;
|
||||||
|
GridStopWatch LinearCombTimer;
|
||||||
GridStopWatch MatrixTimer;
|
GridStopWatch MatrixTimer;
|
||||||
GridStopWatch SolverTimer;
|
GridStopWatch SolverTimer;
|
||||||
|
|
||||||
SolverTimer.Start();
|
SolverTimer.Start();
|
||||||
int k;
|
int k;
|
||||||
for (k = 1; k <= MaxIterations; k++) {
|
for (k = 1; k <= MaxIterations*1000; k++) {
|
||||||
c = cp;
|
c = cp;
|
||||||
|
|
||||||
MatrixTimer.Start();
|
MatrixTimer.Start();
|
||||||
Linop.HermOpAndNorm(p, mmp, d, qq);
|
Linop.HermOp(p, mmp);
|
||||||
MatrixTimer.Stop();
|
MatrixTimer.Stop();
|
||||||
|
|
||||||
LinalgTimer.Start();
|
LinalgTimer.Start();
|
||||||
// RealD qqck = norm2(mmp);
|
|
||||||
// ComplexD dck = innerProduct(p,mmp);
|
|
||||||
|
|
||||||
|
InnerTimer.Start();
|
||||||
|
ComplexD dc = innerProduct(p,mmp);
|
||||||
|
InnerTimer.Stop();
|
||||||
|
d = dc.real();
|
||||||
a = c / d;
|
a = c / d;
|
||||||
b_pred = a * (a * qq - d) / c;
|
|
||||||
|
|
||||||
|
AxpyNormTimer.Start();
|
||||||
cp = axpy_norm(r, -a, mmp, r);
|
cp = axpy_norm(r, -a, mmp, r);
|
||||||
|
AxpyNormTimer.Stop();
|
||||||
b = cp / c;
|
b = cp / c;
|
||||||
|
|
||||||
// Fuse these loops ; should be really easy
|
LinearCombTimer.Start();
|
||||||
psi = a * p + psi;
|
parallel_for(int ss=0;ss<src._grid->oSites();ss++){
|
||||||
p = p * b + r;
|
vstream(psi[ss], a * p[ss] + psi[ss]);
|
||||||
|
vstream(p [ss], b * p[ss] + r[ss]);
|
||||||
|
}
|
||||||
|
LinearCombTimer.Stop();
|
||||||
LinalgTimer.Stop();
|
LinalgTimer.Stop();
|
||||||
|
|
||||||
std::cout << GridLogIterative << "ConjugateGradient: Iteration " << k
|
std::cout << GridLogIterative << "ConjugateGradient: Iteration " << k
|
||||||
<< " residual " << cp << " target " << rsq << std::endl;
|
<< " residual " << cp << " target " << rsq << std::endl;
|
||||||
std::cout << GridLogDebug << "a = "<< a << " b_pred = "<< b_pred << " b = "<< b << std::endl;
|
|
||||||
std::cout << GridLogDebug << "qq = "<< qq << " d = "<< d << " c = "<< c << std::endl;
|
|
||||||
|
|
||||||
// Stopping condition
|
// Stopping condition
|
||||||
if (cp <= rsq) {
|
if (cp <= rsq) {
|
||||||
@@ -148,6 +154,9 @@ class ConjugateGradient : public OperatorFunction<Field> {
|
|||||||
std::cout << GridLogMessage << "\tElapsed " << SolverTimer.Elapsed() <<std::endl;
|
std::cout << GridLogMessage << "\tElapsed " << SolverTimer.Elapsed() <<std::endl;
|
||||||
std::cout << GridLogMessage << "\tMatrix " << MatrixTimer.Elapsed() <<std::endl;
|
std::cout << GridLogMessage << "\tMatrix " << MatrixTimer.Elapsed() <<std::endl;
|
||||||
std::cout << GridLogMessage << "\tLinalg " << LinalgTimer.Elapsed() <<std::endl;
|
std::cout << GridLogMessage << "\tLinalg " << LinalgTimer.Elapsed() <<std::endl;
|
||||||
|
std::cout << GridLogMessage << "\tInner " << InnerTimer.Elapsed() <<std::endl;
|
||||||
|
std::cout << GridLogMessage << "\tAxpyNorm " << AxpyNormTimer.Elapsed() <<std::endl;
|
||||||
|
std::cout << GridLogMessage << "\tLinearComb " << LinearCombTimer.Elapsed() <<std::endl;
|
||||||
|
|
||||||
if (ErrorOnNoConverge) assert(true_residual / Tolerance < 10000.0);
|
if (ErrorOnNoConverge) assert(true_residual / Tolerance < 10000.0);
|
||||||
|
|
||||||
File renamed without changes.
+41
-1
@@ -43,6 +43,7 @@ namespace Grid {
|
|||||||
public:
|
public:
|
||||||
RealD Tolerance;
|
RealD Tolerance;
|
||||||
Integer MaxIterations;
|
Integer MaxIterations;
|
||||||
|
Integer IterationsToComplete; //Number of iterations the CG took to finish. Filled in upon completion
|
||||||
int verbose;
|
int verbose;
|
||||||
MultiShiftFunction shifts;
|
MultiShiftFunction shifts;
|
||||||
|
|
||||||
@@ -164,6 +165,15 @@ void operator() (LinearOperatorBase<Field> &Linop, const Field &src, std::vector
|
|||||||
axpby(psi[s],0.,-bs[s]*alpha[s],src,src);
|
axpby(psi[s],0.,-bs[s]*alpha[s],src,src);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///////////////////////////////////////
|
||||||
|
// Timers
|
||||||
|
///////////////////////////////////////
|
||||||
|
GridStopWatch AXPYTimer;
|
||||||
|
GridStopWatch ShiftTimer;
|
||||||
|
GridStopWatch QRTimer;
|
||||||
|
GridStopWatch MatrixTimer;
|
||||||
|
GridStopWatch SolverTimer;
|
||||||
|
SolverTimer.Start();
|
||||||
|
|
||||||
// Iteration loop
|
// Iteration loop
|
||||||
int k;
|
int k;
|
||||||
@@ -171,7 +181,9 @@ void operator() (LinearOperatorBase<Field> &Linop, const Field &src, std::vector
|
|||||||
for (k=1;k<=MaxIterations;k++){
|
for (k=1;k<=MaxIterations;k++){
|
||||||
|
|
||||||
a = c /cp;
|
a = c /cp;
|
||||||
|
AXPYTimer.Start();
|
||||||
axpy(p,a,p,r);
|
axpy(p,a,p,r);
|
||||||
|
AXPYTimer.Stop();
|
||||||
|
|
||||||
// Note to self - direction ps is iterated seperately
|
// Note to self - direction ps is iterated seperately
|
||||||
// for each shift. Does not appear to have any scope
|
// for each shift. Does not appear to have any scope
|
||||||
@@ -180,6 +192,7 @@ void operator() (LinearOperatorBase<Field> &Linop, const Field &src, std::vector
|
|||||||
// However SAME r is used. Could load "r" and update
|
// However SAME r is used. Could load "r" and update
|
||||||
// ALL ps[s]. 2/3 Bandwidth saving
|
// ALL ps[s]. 2/3 Bandwidth saving
|
||||||
// New Kernel: Load r, vector of coeffs, vector of pointers ps
|
// New Kernel: Load r, vector of coeffs, vector of pointers ps
|
||||||
|
AXPYTimer.Start();
|
||||||
for(int s=0;s<nshift;s++){
|
for(int s=0;s<nshift;s++){
|
||||||
if ( ! converged[s] ) {
|
if ( ! converged[s] ) {
|
||||||
if (s==0){
|
if (s==0){
|
||||||
@@ -190,22 +203,34 @@ void operator() (LinearOperatorBase<Field> &Linop, const Field &src, std::vector
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
AXPYTimer.Stop();
|
||||||
|
|
||||||
cp=c;
|
cp=c;
|
||||||
|
MatrixTimer.Start();
|
||||||
|
//Linop.HermOpAndNorm(p,mmp,d,qq); // d is used
|
||||||
|
// The below is faster on KNL
|
||||||
|
Linop.HermOp(p,mmp);
|
||||||
|
d=real(innerProduct(p,mmp));
|
||||||
|
|
||||||
Linop.HermOpAndNorm(p,mmp,d,qq);
|
MatrixTimer.Stop();
|
||||||
|
|
||||||
|
AXPYTimer.Start();
|
||||||
axpy(mmp,mass[0],p,mmp);
|
axpy(mmp,mass[0],p,mmp);
|
||||||
|
AXPYTimer.Stop();
|
||||||
RealD rn = norm2(p);
|
RealD rn = norm2(p);
|
||||||
d += rn*mass[0];
|
d += rn*mass[0];
|
||||||
|
|
||||||
bp=b;
|
bp=b;
|
||||||
b=-cp/d;
|
b=-cp/d;
|
||||||
|
|
||||||
|
AXPYTimer.Start();
|
||||||
c=axpy_norm(r,b,mmp,r);
|
c=axpy_norm(r,b,mmp,r);
|
||||||
|
AXPYTimer.Stop();
|
||||||
|
|
||||||
// Toggle the recurrence history
|
// Toggle the recurrence history
|
||||||
bs[0] = b;
|
bs[0] = b;
|
||||||
iz = 1-iz;
|
iz = 1-iz;
|
||||||
|
ShiftTimer.Start();
|
||||||
for(int s=1;s<nshift;s++){
|
for(int s=1;s<nshift;s++){
|
||||||
if((!converged[s])){
|
if((!converged[s])){
|
||||||
RealD z0 = z[s][1-iz];
|
RealD z0 = z[s][1-iz];
|
||||||
@@ -215,6 +240,7 @@ void operator() (LinearOperatorBase<Field> &Linop, const Field &src, std::vector
|
|||||||
bs[s] = b*z[s][iz]/z0; // NB sign rel to Mike
|
bs[s] = b*z[s][iz]/z0; // NB sign rel to Mike
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
ShiftTimer.Stop();
|
||||||
|
|
||||||
for(int s=0;s<nshift;s++){
|
for(int s=0;s<nshift;s++){
|
||||||
int ss = s;
|
int ss = s;
|
||||||
@@ -257,6 +283,9 @@ void operator() (LinearOperatorBase<Field> &Linop, const Field &src, std::vector
|
|||||||
|
|
||||||
if ( all_converged ){
|
if ( all_converged ){
|
||||||
|
|
||||||
|
SolverTimer.Stop();
|
||||||
|
|
||||||
|
|
||||||
std::cout<<GridLogMessage<< "CGMultiShift: All shifts have converged iteration "<<k<<std::endl;
|
std::cout<<GridLogMessage<< "CGMultiShift: All shifts have converged iteration "<<k<<std::endl;
|
||||||
std::cout<<GridLogMessage<< "CGMultiShift: Checking solutions"<<std::endl;
|
std::cout<<GridLogMessage<< "CGMultiShift: Checking solutions"<<std::endl;
|
||||||
|
|
||||||
@@ -269,8 +298,19 @@ void operator() (LinearOperatorBase<Field> &Linop, const Field &src, std::vector
|
|||||||
RealD cn = norm2(src);
|
RealD cn = norm2(src);
|
||||||
std::cout<<GridLogMessage<<"CGMultiShift: shift["<<s<<"] true residual "<<std::sqrt(rn/cn)<<std::endl;
|
std::cout<<GridLogMessage<<"CGMultiShift: shift["<<s<<"] true residual "<<std::sqrt(rn/cn)<<std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::cout << GridLogMessage << "Time Breakdown "<<std::endl;
|
||||||
|
std::cout << GridLogMessage << "\tElapsed " << SolverTimer.Elapsed() <<std::endl;
|
||||||
|
std::cout << GridLogMessage << "\tAXPY " << AXPYTimer.Elapsed() <<std::endl;
|
||||||
|
std::cout << GridLogMessage << "\tMarix " << MatrixTimer.Elapsed() <<std::endl;
|
||||||
|
std::cout << GridLogMessage << "\tShift " << ShiftTimer.Elapsed() <<std::endl;
|
||||||
|
|
||||||
|
IterationsToComplete = k;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
// ugly hack
|
// ugly hack
|
||||||
std::cout<<GridLogMessage<<"CG multi shift did not converge"<<std::endl;
|
std::cout<<GridLogMessage<<"CG multi shift did not converge"<<std::endl;
|
||||||
File renamed without changes.
File renamed without changes.
@@ -30,22 +30,23 @@ Author: Peter Boyle <paboyle@ph.ed.ac.uk>
|
|||||||
|
|
||||||
namespace Grid {
|
namespace Grid {
|
||||||
|
|
||||||
struct ZeroGuesser {
|
|
||||||
public:
|
|
||||||
template<class Field>
|
template<class Field>
|
||||||
void operator()(const Field &src,Field &guess) { guess = Zero(); };
|
class ZeroGuesser: public LinearFunction<Field> {
|
||||||
|
public:
|
||||||
|
virtual void operator()(const Field &src, Field &guess) { guess = zero; };
|
||||||
};
|
};
|
||||||
struct SourceGuesser {
|
|
||||||
public:
|
|
||||||
template<class Field>
|
template<class Field>
|
||||||
void operator()(const Field &src,Field &guess) { guess = src; };
|
class SourceGuesser: public LinearFunction<Field> {
|
||||||
|
public:
|
||||||
|
virtual void operator()(const Field &src, Field &guess) { guess = src; };
|
||||||
};
|
};
|
||||||
|
|
||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
// Fine grid deflation
|
// Fine grid deflation
|
||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
template<class Field>
|
template<class Field>
|
||||||
struct DeflatedGuesser {
|
class DeflatedGuesser: public LinearFunction<Field> {
|
||||||
private:
|
private:
|
||||||
const std::vector<Field> &evec;
|
const std::vector<Field> &evec;
|
||||||
const std::vector<RealD> &eval;
|
const std::vector<RealD> &eval;
|
||||||
@@ -54,7 +55,7 @@ public:
|
|||||||
|
|
||||||
DeflatedGuesser(const std::vector<Field> & _evec,const std::vector<RealD> & _eval) : evec(_evec), eval(_eval) {};
|
DeflatedGuesser(const std::vector<Field> & _evec,const std::vector<RealD> & _eval) : evec(_evec), eval(_eval) {};
|
||||||
|
|
||||||
void operator()(const Field &src,Field &guess) {
|
virtual void operator()(const Field &src,Field &guess) {
|
||||||
guess = zero;
|
guess = zero;
|
||||||
assert(evec.size()==eval.size());
|
assert(evec.size()==eval.size());
|
||||||
auto N = evec.size();
|
auto N = evec.size();
|
||||||
@@ -62,11 +63,12 @@ public:
|
|||||||
const Field& tmp = evec[i];
|
const Field& tmp = evec[i];
|
||||||
axpy(guess,TensorRemove(innerProduct(tmp,src)) / eval[i],tmp,guess);
|
axpy(guess,TensorRemove(innerProduct(tmp,src)) / eval[i],tmp,guess);
|
||||||
}
|
}
|
||||||
|
guess.checkerboard = src.checkerboard;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template<class FineField, class CoarseField>
|
template<class FineField, class CoarseField>
|
||||||
class LocalCoherenceDeflatedGuesser {
|
class LocalCoherenceDeflatedGuesser: public LinearFunction<FineField> {
|
||||||
private:
|
private:
|
||||||
const std::vector<FineField> &subspace;
|
const std::vector<FineField> &subspace;
|
||||||
const std::vector<CoarseField> &evec_coarse;
|
const std::vector<CoarseField> &evec_coarse;
|
||||||
@@ -92,6 +94,7 @@ public:
|
|||||||
axpy(guess_coarse,TensorRemove(innerProduct(tmp,src_coarse)) / eval_coarse[i],tmp,guess_coarse);
|
axpy(guess_coarse,TensorRemove(innerProduct(tmp,src_coarse)) / eval_coarse[i],tmp,guess_coarse);
|
||||||
}
|
}
|
||||||
blockPromote(guess_coarse,guess,subspace);
|
blockPromote(guess_coarse,guess,subspace);
|
||||||
|
guess.checkerboard = src.checkerboard;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
+2
-1
@@ -57,7 +57,8 @@ void basisRotate(std::vector<Field> &basis,Eigen::MatrixXd& Qt,int j0, int j1, i
|
|||||||
|
|
||||||
parallel_region
|
parallel_region
|
||||||
{
|
{
|
||||||
std::vector < vobj > B(Nm); // Thread private
|
|
||||||
|
std::vector < vobj , commAllocator<vobj> > B(Nm); // Thread private
|
||||||
|
|
||||||
parallel_for_internal(int ss=0;ss < grid->oSites();ss++){
|
parallel_for_internal(int ss=0;ss < grid->oSites();ss++){
|
||||||
for(int j=j0; j<j1; ++j) B[j]=0.;
|
for(int j=j0; j<j1; ++j) B[j]=0.;
|
||||||
+8
-6
@@ -286,8 +286,10 @@ public:
|
|||||||
|
|
||||||
void Orthogonalise(void ) {
|
void Orthogonalise(void ) {
|
||||||
CoarseScalar InnerProd(_CoarseGrid);
|
CoarseScalar InnerProd(_CoarseGrid);
|
||||||
blockOrthogonalise(InnerProd,subspace);std::cout << GridLogMessage <<" Gramm-Schmidt pass 1"<<std::endl;
|
std::cout << GridLogMessage <<" Gramm-Schmidt pass 1"<<std::endl;
|
||||||
blockOrthogonalise(InnerProd,subspace);std::cout << GridLogMessage <<" Gramm-Schmidt pass 2"<<std::endl;
|
blockOrthogonalise(InnerProd,subspace);
|
||||||
|
std::cout << GridLogMessage <<" Gramm-Schmidt pass 2"<<std::endl;
|
||||||
|
blockOrthogonalise(InnerProd,subspace);
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename T> static RealD normalise(T& v)
|
template<typename T> static RealD normalise(T& v)
|
||||||
@@ -333,7 +335,7 @@ public:
|
|||||||
// create a smoother and see if we can get a cheap convergence test and smooth inside the IRL
|
// create a smoother and see if we can get a cheap convergence test and smooth inside the IRL
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
Chebyshev<FineField> ChebySmooth(cheby_smooth);
|
Chebyshev<FineField> ChebySmooth(cheby_smooth);
|
||||||
ProjectedFunctionHermOp<Fobj,CComplex,nbasis> ChebyOp (ChebySmooth,_FineOp,_subspace);
|
ProjectedFunctionHermOp<Fobj,CComplex,nbasis> ChebyOp (ChebySmooth,_FineOp,subspace);
|
||||||
ImplicitlyRestartedLanczosSmoothedTester<Fobj,CComplex,nbasis> ChebySmoothTester(ChebyOp,ChebySmooth,_FineOp,subspace,relax);
|
ImplicitlyRestartedLanczosSmoothedTester<Fobj,CComplex,nbasis> ChebySmoothTester(ChebyOp,ChebySmooth,_FineOp,subspace,relax);
|
||||||
|
|
||||||
for(int k=0;k<evec_coarse.size();k++){
|
for(int k=0;k<evec_coarse.size();k++){
|
||||||
@@ -374,14 +376,14 @@ public:
|
|||||||
RealD MaxIt, RealD betastp, int MinRes)
|
RealD MaxIt, RealD betastp, int MinRes)
|
||||||
{
|
{
|
||||||
Chebyshev<FineField> Cheby(cheby_op);
|
Chebyshev<FineField> Cheby(cheby_op);
|
||||||
ProjectedHermOp<Fobj,CComplex,nbasis> Op(_FineOp,_subspace);
|
ProjectedHermOp<Fobj,CComplex,nbasis> Op(_FineOp,subspace);
|
||||||
ProjectedFunctionHermOp<Fobj,CComplex,nbasis> ChebyOp (Cheby,_FineOp,_subspace);
|
ProjectedFunctionHermOp<Fobj,CComplex,nbasis> ChebyOp (Cheby,_FineOp,subspace);
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// create a smoother and see if we can get a cheap convergence test and smooth inside the IRL
|
// create a smoother and see if we can get a cheap convergence test and smooth inside the IRL
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
Chebyshev<FineField> ChebySmooth(cheby_smooth);
|
Chebyshev<FineField> ChebySmooth(cheby_smooth);
|
||||||
ImplicitlyRestartedLanczosSmoothedTester<Fobj,CComplex,nbasis> ChebySmoothTester(ChebyOp,ChebySmooth,_FineOp,_subspace,relax);
|
ImplicitlyRestartedLanczosSmoothedTester<Fobj,CComplex,nbasis> ChebySmoothTester(ChebyOp,ChebySmooth,_FineOp,subspace,relax);
|
||||||
|
|
||||||
evals_coarse.resize(Nm);
|
evals_coarse.resize(Nm);
|
||||||
evec_coarse.resize(Nm,_CoarseGrid);
|
evec_coarse.resize(Nm,_CoarseGrid);
|
||||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -0,0 +1,186 @@
|
|||||||
|
/*************************************************************************************
|
||||||
|
|
||||||
|
Grid physics library, www.github.com/paboyle/Grid
|
||||||
|
|
||||||
|
Source file: ./lib/algorithms/iterative/SchurRedBlack.h
|
||||||
|
|
||||||
|
Copyright (C) 2015
|
||||||
|
|
||||||
|
Author: Peter Boyle <paboyle@ph.ed.ac.uk>
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License along
|
||||||
|
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
|
||||||
|
See the full license in the file "LICENSE" in the top level distribution directory
|
||||||
|
*************************************************************************************/
|
||||||
|
/* END LEGAL */
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
namespace Grid {
|
||||||
|
namespace QCD {
|
||||||
|
|
||||||
|
|
||||||
|
template<class Field>
|
||||||
|
class PauliVillarsSolverUnprec
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
ConjugateGradient<Field> & CG;
|
||||||
|
PauliVillarsSolverUnprec( ConjugateGradient<Field> &_CG) : CG(_CG){};
|
||||||
|
|
||||||
|
template<class Matrix>
|
||||||
|
void operator() (Matrix &_Matrix,const Field &src,Field &sol)
|
||||||
|
{
|
||||||
|
RealD m = _Matrix.Mass();
|
||||||
|
Field A (_Matrix.FermionGrid());
|
||||||
|
|
||||||
|
MdagMLinearOperator<Matrix,Field> HermOp(_Matrix);
|
||||||
|
|
||||||
|
_Matrix.SetMass(1.0);
|
||||||
|
_Matrix.Mdag(src,A);
|
||||||
|
CG(HermOp,A,sol);
|
||||||
|
_Matrix.SetMass(m);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
template<class Field>
|
||||||
|
class PauliVillarsSolverRBprec
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
ConjugateGradient<Field> & CG;
|
||||||
|
PauliVillarsSolverRBprec( ConjugateGradient<Field> &_CG) : CG(_CG){};
|
||||||
|
|
||||||
|
template<class Matrix>
|
||||||
|
void operator() (Matrix &_Matrix,const Field &src,Field &sol)
|
||||||
|
{
|
||||||
|
RealD m = _Matrix.Mass();
|
||||||
|
Field A (_Matrix.FermionGrid());
|
||||||
|
|
||||||
|
_Matrix.SetMass(1.0);
|
||||||
|
SchurRedBlackDiagMooeeSolve<Field> SchurSolver(CG);
|
||||||
|
SchurSolver(_Matrix,src,sol);
|
||||||
|
_Matrix.SetMass(m);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
template<class Field,class PVinverter> class Reconstruct5DfromPhysical {
|
||||||
|
private:
|
||||||
|
PVinverter & PauliVillarsSolver;
|
||||||
|
public:
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
// First cut works, 10 Oct 2018.
|
||||||
|
//
|
||||||
|
// Must form a plan to get this into production for Zmobius acceleration
|
||||||
|
// of the Mobius exact AMA corrections.
|
||||||
|
//
|
||||||
|
// TODO : understand absence of contact term in eqns in Hantao's thesis
|
||||||
|
// sol4 is contact term subtracted.
|
||||||
|
//
|
||||||
|
// Options
|
||||||
|
// a) Defect correction approach:
|
||||||
|
// 1) Compute defect from current soln (initially guess).
|
||||||
|
// This is ...... outerToInner check !!!!
|
||||||
|
// 2) Deflated Zmobius solve to get 4d soln
|
||||||
|
// Ensure deflation is working
|
||||||
|
// 3) Refine 5d Outer using the inner 4d delta soln
|
||||||
|
//
|
||||||
|
// Step 1: localise PV inverse in a routine. [DONE]
|
||||||
|
// Step 2: Schur based PV inverse [DONE]
|
||||||
|
// Step 3: Fourier accelerated PV inverse
|
||||||
|
// Step 4:
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
Reconstruct5DfromPhysical(PVinverter &_PauliVillarsSolver)
|
||||||
|
: PauliVillarsSolver(_PauliVillarsSolver)
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
template<class Matrix>
|
||||||
|
void PV(Matrix &_Matrix,const Field &src,Field &sol)
|
||||||
|
{
|
||||||
|
RealD m = _Matrix.Mass();
|
||||||
|
_Matrix.SetMass(1.0);
|
||||||
|
_Matrix.M(src,sol);
|
||||||
|
_Matrix.SetMass(m);
|
||||||
|
}
|
||||||
|
template<class Matrix>
|
||||||
|
void PVdag(Matrix &_Matrix,const Field &src,Field &sol)
|
||||||
|
{
|
||||||
|
RealD m = _Matrix.Mass();
|
||||||
|
_Matrix.SetMass(1.0);
|
||||||
|
_Matrix.Mdag(src,sol);
|
||||||
|
_Matrix.SetMass(m);
|
||||||
|
}
|
||||||
|
template<class Matrix>
|
||||||
|
void operator() (Matrix & _Matrix,const Field &sol4,const Field &src4, Field &sol5){
|
||||||
|
|
||||||
|
int Ls = _Matrix.Ls;
|
||||||
|
|
||||||
|
Field psi4(_Matrix.GaugeGrid());
|
||||||
|
Field psi(_Matrix.FermionGrid());
|
||||||
|
Field A (_Matrix.FermionGrid());
|
||||||
|
Field B (_Matrix.FermionGrid());
|
||||||
|
Field c (_Matrix.FermionGrid());
|
||||||
|
|
||||||
|
typedef typename Matrix::Coeff_t Coeff_t;
|
||||||
|
|
||||||
|
std::cout << GridLogMessage<< " ************************************************" << std::endl;
|
||||||
|
std::cout << GridLogMessage<< " Reconstruct5Dprop: c.f. MADWF algorithm " << std::endl;
|
||||||
|
std::cout << GridLogMessage<< " ************************************************" << std::endl;
|
||||||
|
|
||||||
|
///////////////////////////////////////
|
||||||
|
//Import source, include Dminus factors
|
||||||
|
///////////////////////////////////////
|
||||||
|
_Matrix.ImportPhysicalFermionSource(src4,B);
|
||||||
|
|
||||||
|
///////////////////////////////////////
|
||||||
|
// Set up c from src4
|
||||||
|
///////////////////////////////////////
|
||||||
|
PauliVillarsSolver(_Matrix,B,A);
|
||||||
|
_Matrix.Pdag(A,c);
|
||||||
|
|
||||||
|
//////////////////////////////////////
|
||||||
|
// Build Pdag PV^-1 Dm P [-sol4,c2,c3... cL]
|
||||||
|
//////////////////////////////////////
|
||||||
|
psi4 = - sol4;
|
||||||
|
InsertSlice(psi4, psi, 0 , 0);
|
||||||
|
for (int s=1;s<Ls;s++) {
|
||||||
|
ExtractSlice(psi4,c,s,0);
|
||||||
|
InsertSlice(psi4,psi,s,0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////////////////////////
|
||||||
|
// Pdag PV^-1 Dm P
|
||||||
|
/////////////////////////////
|
||||||
|
_Matrix.P(psi,B);
|
||||||
|
_Matrix.M(B,A);
|
||||||
|
PauliVillarsSolver(_Matrix,A,B);
|
||||||
|
_Matrix.Pdag(B,A);
|
||||||
|
|
||||||
|
//////////////////////////////
|
||||||
|
// Reinsert surface prop
|
||||||
|
//////////////////////////////
|
||||||
|
InsertSlice(sol4,A,0,0);
|
||||||
|
|
||||||
|
//////////////////////////////
|
||||||
|
// Convert from y back to x
|
||||||
|
//////////////////////////////
|
||||||
|
_Matrix.P(A,sol5);
|
||||||
|
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
+77
-9
@@ -95,20 +95,30 @@ namespace Grid {
|
|||||||
private:
|
private:
|
||||||
OperatorFunction<Field> & _HermitianRBSolver;
|
OperatorFunction<Field> & _HermitianRBSolver;
|
||||||
int CBfactorise;
|
int CBfactorise;
|
||||||
|
bool subGuess;
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////
|
||||||
// Wrap the usual normal equations Schur trick
|
// Wrap the usual normal equations Schur trick
|
||||||
/////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////
|
||||||
SchurRedBlackStaggeredSolve(OperatorFunction<Field> &HermitianRBSolver) :
|
SchurRedBlackStaggeredSolve(OperatorFunction<Field> &HermitianRBSolver, const bool initSubGuess = false) :
|
||||||
_HermitianRBSolver(HermitianRBSolver)
|
_HermitianRBSolver(HermitianRBSolver)
|
||||||
{
|
{
|
||||||
CBfactorise=0;
|
CBfactorise=0;
|
||||||
|
subtractGuess(initSubGuess);
|
||||||
};
|
};
|
||||||
|
void subtractGuess(const bool initSubGuess)
|
||||||
|
{
|
||||||
|
subGuess = initSubGuess;
|
||||||
|
}
|
||||||
|
bool isSubtractGuess(void)
|
||||||
|
{
|
||||||
|
return subGuess;
|
||||||
|
}
|
||||||
|
|
||||||
template<class Matrix>
|
template<class Matrix>
|
||||||
void operator() (Matrix & _Matrix,const Field &in, Field &out){
|
void operator() (Matrix & _Matrix,const Field &in, Field &out){
|
||||||
ZeroGuesser guess;
|
ZeroGuesser<Field> guess;
|
||||||
(*this)(_Matrix,in,out,guess);
|
(*this)(_Matrix,in,out,guess);
|
||||||
}
|
}
|
||||||
template<class Matrix, class Guesser>
|
template<class Matrix, class Guesser>
|
||||||
@@ -151,8 +161,11 @@ namespace Grid {
|
|||||||
//////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////
|
||||||
std::cout<<GridLogMessage << "SchurRedBlackStaggeredSolver calling the Mpc solver" <<std::endl;
|
std::cout<<GridLogMessage << "SchurRedBlackStaggeredSolver calling the Mpc solver" <<std::endl;
|
||||||
guess(src_o, sol_o);
|
guess(src_o, sol_o);
|
||||||
|
Mtmp = sol_o;
|
||||||
_HermitianRBSolver(_HermOpEO,src_o,sol_o); assert(sol_o.checkerboard==Odd);
|
_HermitianRBSolver(_HermOpEO,src_o,sol_o); assert(sol_o.checkerboard==Odd);
|
||||||
std::cout<<GridLogMessage << "SchurRedBlackStaggeredSolver called the Mpc solver" <<std::endl;
|
std::cout<<GridLogMessage << "SchurRedBlackStaggeredSolver called the Mpc solver" <<std::endl;
|
||||||
|
// Fionn A2A boolean behavioural control
|
||||||
|
if (subGuess) sol_o = sol_o-Mtmp;
|
||||||
|
|
||||||
///////////////////////////////////////////////////
|
///////////////////////////////////////////////////
|
||||||
// sol_e = M_ee^-1 * ( src_e - Meo sol_o )...
|
// sol_e = M_ee^-1 * ( src_e - Meo sol_o )...
|
||||||
@@ -167,11 +180,15 @@ namespace Grid {
|
|||||||
std::cout<<GridLogMessage << "SchurRedBlackStaggeredSolver inserted solution" <<std::endl;
|
std::cout<<GridLogMessage << "SchurRedBlackStaggeredSolver inserted solution" <<std::endl;
|
||||||
|
|
||||||
// Verify the unprec residual
|
// Verify the unprec residual
|
||||||
|
if ( ! subGuess ) {
|
||||||
_Matrix.M(out,resid);
|
_Matrix.M(out,resid);
|
||||||
resid = resid-in;
|
resid = resid-in;
|
||||||
RealD ns = norm2(in);
|
RealD ns = norm2(in);
|
||||||
RealD nr = norm2(resid);
|
RealD nr = norm2(resid);
|
||||||
std::cout<<GridLogMessage << "SchurRedBlackStaggered solver true unprec resid "<< std::sqrt(nr/ns) <<" nr "<< nr <<" ns "<<ns << std::endl;
|
std::cout<<GridLogMessage << "SchurRedBlackStaggered solver true unprec resid "<< std::sqrt(nr/ns) <<" nr "<< nr <<" ns "<<ns << std::endl;
|
||||||
|
} else {
|
||||||
|
std::cout << GridLogMessage << "Guess subtracted after solve." << std::endl;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
template<class Field> using SchurRedBlackStagSolve = SchurRedBlackStaggeredSolve<Field>;
|
template<class Field> using SchurRedBlackStagSolve = SchurRedBlackStaggeredSolve<Field>;
|
||||||
@@ -184,18 +201,28 @@ namespace Grid {
|
|||||||
private:
|
private:
|
||||||
OperatorFunction<Field> & _HermitianRBSolver;
|
OperatorFunction<Field> & _HermitianRBSolver;
|
||||||
int CBfactorise;
|
int CBfactorise;
|
||||||
|
bool subGuess;
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////
|
||||||
// Wrap the usual normal equations Schur trick
|
// Wrap the usual normal equations Schur trick
|
||||||
/////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////
|
||||||
SchurRedBlackDiagMooeeSolve(OperatorFunction<Field> &HermitianRBSolver,int cb=0) : _HermitianRBSolver(HermitianRBSolver)
|
SchurRedBlackDiagMooeeSolve(OperatorFunction<Field> &HermitianRBSolver,int cb=0, const bool initSubGuess = false) : _HermitianRBSolver(HermitianRBSolver)
|
||||||
{
|
{
|
||||||
CBfactorise=cb;
|
CBfactorise=cb;
|
||||||
|
subtractGuess(initSubGuess);
|
||||||
};
|
};
|
||||||
|
void subtractGuess(const bool initSubGuess)
|
||||||
|
{
|
||||||
|
subGuess = initSubGuess;
|
||||||
|
}
|
||||||
|
bool isSubtractGuess(void)
|
||||||
|
{
|
||||||
|
return subGuess;
|
||||||
|
}
|
||||||
template<class Matrix>
|
template<class Matrix>
|
||||||
void operator() (Matrix & _Matrix,const Field &in, Field &out){
|
void operator() (Matrix & _Matrix,const Field &in, Field &out){
|
||||||
ZeroGuesser guess;
|
ZeroGuesser<Field> guess;
|
||||||
(*this)(_Matrix,in,out,guess);
|
(*this)(_Matrix,in,out,guess);
|
||||||
}
|
}
|
||||||
template<class Matrix, class Guesser>
|
template<class Matrix, class Guesser>
|
||||||
@@ -236,7 +263,10 @@ namespace Grid {
|
|||||||
//////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////
|
||||||
std::cout<<GridLogMessage << "SchurRedBlack solver calling the MpcDagMp solver" <<std::endl;
|
std::cout<<GridLogMessage << "SchurRedBlack solver calling the MpcDagMp solver" <<std::endl;
|
||||||
guess(src_o,sol_o);
|
guess(src_o,sol_o);
|
||||||
|
Mtmp = sol_o;
|
||||||
_HermitianRBSolver(_HermOpEO,src_o,sol_o); assert(sol_o.checkerboard==Odd);
|
_HermitianRBSolver(_HermOpEO,src_o,sol_o); assert(sol_o.checkerboard==Odd);
|
||||||
|
// Fionn A2A boolean behavioural control
|
||||||
|
if (subGuess) sol_o = sol_o-Mtmp;
|
||||||
|
|
||||||
///////////////////////////////////////////////////
|
///////////////////////////////////////////////////
|
||||||
// sol_e = M_ee^-1 * ( src_e - Meo sol_o )...
|
// sol_e = M_ee^-1 * ( src_e - Meo sol_o )...
|
||||||
@@ -249,12 +279,16 @@ namespace Grid {
|
|||||||
setCheckerboard(out,sol_o); assert( sol_o.checkerboard ==Odd );
|
setCheckerboard(out,sol_o); assert( sol_o.checkerboard ==Odd );
|
||||||
|
|
||||||
// Verify the unprec residual
|
// Verify the unprec residual
|
||||||
|
if ( ! subGuess ) {
|
||||||
_Matrix.M(out,resid);
|
_Matrix.M(out,resid);
|
||||||
resid = resid-in;
|
resid = resid-in;
|
||||||
RealD ns = norm2(in);
|
RealD ns = norm2(in);
|
||||||
RealD nr = norm2(resid);
|
RealD nr = norm2(resid);
|
||||||
|
|
||||||
std::cout<<GridLogMessage << "SchurRedBlackDiagMooee solver true unprec resid "<< std::sqrt(nr/ns) <<" nr "<< nr <<" ns "<<ns << std::endl;
|
std::cout<<GridLogMessage << "SchurRedBlackDiagMooee solver true unprec resid "<< std::sqrt(nr/ns) <<" nr "<< nr <<" ns "<<ns << std::endl;
|
||||||
|
} else {
|
||||||
|
std::cout << GridLogMessage << "Guess subtracted after solve." << std::endl;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -267,20 +301,30 @@ namespace Grid {
|
|||||||
private:
|
private:
|
||||||
OperatorFunction<Field> & _HermitianRBSolver;
|
OperatorFunction<Field> & _HermitianRBSolver;
|
||||||
int CBfactorise;
|
int CBfactorise;
|
||||||
|
bool subGuess;
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////
|
||||||
// Wrap the usual normal equations Schur trick
|
// Wrap the usual normal equations Schur trick
|
||||||
/////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////
|
||||||
SchurRedBlackDiagTwoSolve(OperatorFunction<Field> &HermitianRBSolver) :
|
SchurRedBlackDiagTwoSolve(OperatorFunction<Field> &HermitianRBSolver, const bool initSubGuess = false) :
|
||||||
_HermitianRBSolver(HermitianRBSolver)
|
_HermitianRBSolver(HermitianRBSolver)
|
||||||
{
|
{
|
||||||
CBfactorise = 0;
|
CBfactorise = 0;
|
||||||
|
subtractGuess(initSubGuess);
|
||||||
};
|
};
|
||||||
|
void subtractGuess(const bool initSubGuess)
|
||||||
|
{
|
||||||
|
subGuess = initSubGuess;
|
||||||
|
}
|
||||||
|
bool isSubtractGuess(void)
|
||||||
|
{
|
||||||
|
return subGuess;
|
||||||
|
}
|
||||||
|
|
||||||
template<class Matrix>
|
template<class Matrix>
|
||||||
void operator() (Matrix & _Matrix,const Field &in, Field &out){
|
void operator() (Matrix & _Matrix,const Field &in, Field &out){
|
||||||
ZeroGuesser guess;
|
ZeroGuesser<Field> guess;
|
||||||
(*this)(_Matrix,in,out,guess);
|
(*this)(_Matrix,in,out,guess);
|
||||||
}
|
}
|
||||||
template<class Matrix,class Guesser>
|
template<class Matrix,class Guesser>
|
||||||
@@ -322,7 +366,10 @@ namespace Grid {
|
|||||||
std::cout<<GridLogMessage << "SchurRedBlack solver calling the MpcDagMp solver" <<std::endl;
|
std::cout<<GridLogMessage << "SchurRedBlack solver calling the MpcDagMp solver" <<std::endl;
|
||||||
// _HermitianRBSolver(_HermOpEO,src_o,sol_o); assert(sol_o.checkerboard==Odd);
|
// _HermitianRBSolver(_HermOpEO,src_o,sol_o); assert(sol_o.checkerboard==Odd);
|
||||||
guess(src_o,tmp);
|
guess(src_o,tmp);
|
||||||
|
Mtmp = tmp;
|
||||||
_HermitianRBSolver(_HermOpEO,src_o,tmp); assert(tmp.checkerboard==Odd);
|
_HermitianRBSolver(_HermOpEO,src_o,tmp); assert(tmp.checkerboard==Odd);
|
||||||
|
// Fionn A2A boolean behavioural control
|
||||||
|
if (subGuess) tmp = tmp-Mtmp;
|
||||||
_Matrix.MooeeInv(tmp,sol_o); assert( sol_o.checkerboard ==Odd);
|
_Matrix.MooeeInv(tmp,sol_o); assert( sol_o.checkerboard ==Odd);
|
||||||
|
|
||||||
///////////////////////////////////////////////////
|
///////////////////////////////////////////////////
|
||||||
@@ -336,12 +383,16 @@ namespace Grid {
|
|||||||
setCheckerboard(out,sol_o); assert( sol_o.checkerboard ==Odd );
|
setCheckerboard(out,sol_o); assert( sol_o.checkerboard ==Odd );
|
||||||
|
|
||||||
// Verify the unprec residual
|
// Verify the unprec residual
|
||||||
|
if ( ! subGuess ) {
|
||||||
_Matrix.M(out,resid);
|
_Matrix.M(out,resid);
|
||||||
resid = resid-in;
|
resid = resid-in;
|
||||||
RealD ns = norm2(in);
|
RealD ns = norm2(in);
|
||||||
RealD nr = norm2(resid);
|
RealD nr = norm2(resid);
|
||||||
|
|
||||||
std::cout<<GridLogMessage << "SchurRedBlackDiagTwo solver true unprec resid "<< std::sqrt(nr/ns) <<" nr "<< nr <<" ns "<<ns << std::endl;
|
std::cout<<GridLogMessage << "SchurRedBlackDiagTwo solver true unprec resid "<< std::sqrt(nr/ns) <<" nr "<< nr <<" ns "<<ns << std::endl;
|
||||||
|
} else {
|
||||||
|
std::cout << GridLogMessage << "Guess subtracted after solve." << std::endl;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
@@ -352,20 +403,30 @@ namespace Grid {
|
|||||||
private:
|
private:
|
||||||
LinearFunction<Field> & _HermitianRBSolver;
|
LinearFunction<Field> & _HermitianRBSolver;
|
||||||
int CBfactorise;
|
int CBfactorise;
|
||||||
|
bool subGuess;
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////
|
||||||
// Wrap the usual normal equations Schur trick
|
// Wrap the usual normal equations Schur trick
|
||||||
/////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////
|
||||||
SchurRedBlackDiagTwoMixed(LinearFunction<Field> &HermitianRBSolver) :
|
SchurRedBlackDiagTwoMixed(LinearFunction<Field> &HermitianRBSolver, const bool initSubGuess = false) :
|
||||||
_HermitianRBSolver(HermitianRBSolver)
|
_HermitianRBSolver(HermitianRBSolver)
|
||||||
{
|
{
|
||||||
CBfactorise=0;
|
CBfactorise=0;
|
||||||
|
subtractGuess(initSubGuess);
|
||||||
};
|
};
|
||||||
|
void subtractGuess(const bool initSubGuess)
|
||||||
|
{
|
||||||
|
subGuess = initSubGuess;
|
||||||
|
}
|
||||||
|
bool isSubtractGuess(void)
|
||||||
|
{
|
||||||
|
return subGuess;
|
||||||
|
}
|
||||||
|
|
||||||
template<class Matrix>
|
template<class Matrix>
|
||||||
void operator() (Matrix & _Matrix,const Field &in, Field &out){
|
void operator() (Matrix & _Matrix,const Field &in, Field &out){
|
||||||
ZeroGuesser guess;
|
ZeroGuesser<Field> guess;
|
||||||
(*this)(_Matrix,in,out,guess);
|
(*this)(_Matrix,in,out,guess);
|
||||||
}
|
}
|
||||||
template<class Matrix, class Guesser>
|
template<class Matrix, class Guesser>
|
||||||
@@ -408,7 +469,10 @@ namespace Grid {
|
|||||||
// _HermitianRBSolver(_HermOpEO,src_o,sol_o); assert(sol_o.checkerboard==Odd);
|
// _HermitianRBSolver(_HermOpEO,src_o,sol_o); assert(sol_o.checkerboard==Odd);
|
||||||
// _HermitianRBSolver(_HermOpEO,src_o,tmp); assert(tmp.checkerboard==Odd);
|
// _HermitianRBSolver(_HermOpEO,src_o,tmp); assert(tmp.checkerboard==Odd);
|
||||||
guess(src_o,tmp);
|
guess(src_o,tmp);
|
||||||
_HermitianRBSolver(src_o,tmp); assert(tmp.checkerboard==Odd);
|
Mtmp = tmp;
|
||||||
|
_HermitianRBSolver(_HermOpEO,src_o,tmp); assert(tmp.checkerboard==Odd);
|
||||||
|
// Fionn A2A boolean behavioural control
|
||||||
|
if (subGuess) tmp = tmp-Mtmp;
|
||||||
_Matrix.MooeeInv(tmp,sol_o); assert( sol_o.checkerboard ==Odd);
|
_Matrix.MooeeInv(tmp,sol_o); assert( sol_o.checkerboard ==Odd);
|
||||||
|
|
||||||
///////////////////////////////////////////////////
|
///////////////////////////////////////////////////
|
||||||
@@ -422,12 +486,16 @@ namespace Grid {
|
|||||||
setCheckerboard(out,sol_o); assert( sol_o.checkerboard ==Odd );
|
setCheckerboard(out,sol_o); assert( sol_o.checkerboard ==Odd );
|
||||||
|
|
||||||
// Verify the unprec residual
|
// Verify the unprec residual
|
||||||
|
if ( ! subGuess ) {
|
||||||
_Matrix.M(out,resid);
|
_Matrix.M(out,resid);
|
||||||
resid = resid-in;
|
resid = resid-in;
|
||||||
RealD ns = norm2(in);
|
RealD ns = norm2(in);
|
||||||
RealD nr = norm2(resid);
|
RealD nr = norm2(resid);
|
||||||
|
|
||||||
std::cout << GridLogMessage << "SchurRedBlackDiagTwo solver true unprec resid " << std::sqrt(nr / ns) << " nr " << nr << " ns " << ns << std::endl;
|
std::cout << GridLogMessage << "SchurRedBlackDiagTwo solver true unprec resid " << std::sqrt(nr / ns) << " nr " << nr << " ns " << ns << std::endl;
|
||||||
|
} else {
|
||||||
|
std::cout << GridLogMessage << "Guess subtracted after solve." << std::endl;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -114,19 +114,150 @@ void GlobalSharedMemory::Init(Grid_MPI_Comm comm)
|
|||||||
assert(WorldNode!=-1);
|
assert(WorldNode!=-1);
|
||||||
_ShmSetup=1;
|
_ShmSetup=1;
|
||||||
}
|
}
|
||||||
|
// Gray encode support
|
||||||
void GlobalSharedMemory::OptimalCommunicator(const std::vector<int> &processors,Grid_MPI_Comm & optimal_comm)
|
int BinaryToGray (int binary) {
|
||||||
|
int gray = (binary>>1)^binary;
|
||||||
|
return gray;
|
||||||
|
}
|
||||||
|
int Log2Size(int TwoToPower,int MAXLOG2)
|
||||||
{
|
{
|
||||||
////////////////////////////////////////////////////////////////
|
|
||||||
// Assert power of two shm_size.
|
|
||||||
////////////////////////////////////////////////////////////////
|
|
||||||
int log2size = -1;
|
int log2size = -1;
|
||||||
for(int i=0;i<=MAXLOG2RANKSPERNODE;i++){
|
for(int i=0;i<=MAXLOG2;i++){
|
||||||
if ( (0x1<<i) == WorldShmSize ) {
|
if ( (0x1<<i) == TwoToPower ) {
|
||||||
log2size = i;
|
log2size = i;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return log2size;
|
||||||
|
}
|
||||||
|
void GlobalSharedMemory::OptimalCommunicator(const std::vector<int> &processors,Grid_MPI_Comm & optimal_comm)
|
||||||
|
{
|
||||||
|
#ifdef HYPERCUBE
|
||||||
|
////////////////////////////////////////////////////////////////
|
||||||
|
// Assert power of two shm_size.
|
||||||
|
////////////////////////////////////////////////////////////////
|
||||||
|
int log2size = Log2Size(WorldShmSize,MAXLOG2RANKSPERNODE);
|
||||||
|
assert(log2size != -1);
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////
|
||||||
|
// Identify the hypercube coordinate of this node using hostname
|
||||||
|
////////////////////////////////////////////////////////////////
|
||||||
|
// n runs 0...7 9...16 18...25 27...34 (8*4) 5 bits
|
||||||
|
// i runs 0..7 3 bits
|
||||||
|
// r runs 0..3 2 bits
|
||||||
|
// 2^10 = 1024 nodes
|
||||||
|
const int maxhdim = 10;
|
||||||
|
std::vector<int> HyperCubeCoords(maxhdim,0);
|
||||||
|
std::vector<int> RootHyperCubeCoords(maxhdim,0);
|
||||||
|
int R;
|
||||||
|
int I;
|
||||||
|
int N;
|
||||||
|
const int namelen = _POSIX_HOST_NAME_MAX;
|
||||||
|
char name[namelen];
|
||||||
|
|
||||||
|
// Parse ICE-XA hostname to get hypercube location
|
||||||
|
gethostname(name,namelen);
|
||||||
|
int nscan = sscanf(name,"r%di%dn%d",&R,&I,&N) ;
|
||||||
|
assert(nscan==3);
|
||||||
|
|
||||||
|
int nlo = N%9;
|
||||||
|
int nhi = N/9;
|
||||||
|
uint32_t hypercoor = (R<<8)|(I<<5)|(nhi<<3)|nlo ;
|
||||||
|
uint32_t rootcoor = hypercoor;
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////
|
||||||
|
// Print debug info
|
||||||
|
//////////////////////////////////////////////////////////////////
|
||||||
|
for(int d=0;d<maxhdim;d++){
|
||||||
|
HyperCubeCoords[d] = (hypercoor>>d)&0x1;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string hname(name);
|
||||||
|
std::cout << "hostname "<<hname<<std::endl;
|
||||||
|
std::cout << "R " << R << " I " << I << " N "<< N
|
||||||
|
<< " hypercoor 0x"<<std::hex<<hypercoor<<std::dec<<std::endl;
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////
|
||||||
|
// broadcast node 0's base coordinate for this partition.
|
||||||
|
//////////////////////////////////////////////////////////////////
|
||||||
|
MPI_Bcast(&rootcoor, sizeof(rootcoor), MPI_BYTE, 0, WorldComm);
|
||||||
|
hypercoor=hypercoor-rootcoor;
|
||||||
|
assert(hypercoor<WorldSize);
|
||||||
|
assert(hypercoor>=0);
|
||||||
|
|
||||||
|
//////////////////////////////////////
|
||||||
|
// Printing
|
||||||
|
//////////////////////////////////////
|
||||||
|
for(int d=0;d<maxhdim;d++){
|
||||||
|
HyperCubeCoords[d] = (hypercoor>>d)&0x1;
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////
|
||||||
|
// Identify subblock of ranks on node spreading across dims
|
||||||
|
// in a maximally symmetrical way
|
||||||
|
////////////////////////////////////////////////////////////////
|
||||||
|
int ndimension = processors.size();
|
||||||
|
std::vector<int> processor_coor(ndimension);
|
||||||
|
std::vector<int> WorldDims = processors; std::vector<int> ShmDims (ndimension,1); std::vector<int> NodeDims (ndimension);
|
||||||
|
std::vector<int> ShmCoor (ndimension); std::vector<int> NodeCoor (ndimension); std::vector<int> WorldCoor(ndimension);
|
||||||
|
std::vector<int> HyperCoor(ndimension);
|
||||||
|
int dim = 0;
|
||||||
|
for(int l2=0;l2<log2size;l2++){
|
||||||
|
while ( (WorldDims[dim] / ShmDims[dim]) <= 1 ) dim=(dim+1)%ndimension;
|
||||||
|
ShmDims[dim]*=2;
|
||||||
|
dim=(dim+1)%ndimension;
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////
|
||||||
|
// Establish torus of processes and nodes with sub-blockings
|
||||||
|
////////////////////////////////////////////////////////////////
|
||||||
|
for(int d=0;d<ndimension;d++){
|
||||||
|
NodeDims[d] = WorldDims[d]/ShmDims[d];
|
||||||
|
}
|
||||||
|
////////////////////////////////////////////////////////////////
|
||||||
|
// Map Hcube according to physical lattice
|
||||||
|
// must partition. Loop over dims and find out who would join.
|
||||||
|
////////////////////////////////////////////////////////////////
|
||||||
|
int hcoor = hypercoor;
|
||||||
|
for(int d=0;d<ndimension;d++){
|
||||||
|
int bits = Log2Size(NodeDims[d],MAXLOG2RANKSPERNODE);
|
||||||
|
int msk = (0x1<<bits)-1;
|
||||||
|
HyperCoor[d]=hcoor & msk;
|
||||||
|
HyperCoor[d]=BinaryToGray(HyperCoor[d]); // Space filling curve magic
|
||||||
|
hcoor = hcoor >> bits;
|
||||||
|
}
|
||||||
|
////////////////////////////////////////////////////////////////
|
||||||
|
// Check processor counts match
|
||||||
|
////////////////////////////////////////////////////////////////
|
||||||
|
int Nprocessors=1;
|
||||||
|
for(int i=0;i<ndimension;i++){
|
||||||
|
Nprocessors*=processors[i];
|
||||||
|
}
|
||||||
|
assert(WorldSize==Nprocessors);
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////
|
||||||
|
// Establish mapping between lexico physics coord and WorldRank
|
||||||
|
////////////////////////////////////////////////////////////////
|
||||||
|
int rank;
|
||||||
|
|
||||||
|
Lexicographic::CoorFromIndexReversed(NodeCoor,WorldNode ,NodeDims);
|
||||||
|
|
||||||
|
for(int d=0;d<ndimension;d++) NodeCoor[d]=HyperCoor[d];
|
||||||
|
|
||||||
|
Lexicographic::CoorFromIndexReversed(ShmCoor ,WorldShmRank,ShmDims);
|
||||||
|
for(int d=0;d<ndimension;d++) WorldCoor[d] = NodeCoor[d]*ShmDims[d]+ShmCoor[d];
|
||||||
|
Lexicographic::IndexFromCoorReversed(WorldCoor,rank,WorldDims);
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////
|
||||||
|
// Build the new communicator
|
||||||
|
/////////////////////////////////////////////////////////////////
|
||||||
|
int ierr= MPI_Comm_split(WorldComm,0,rank,&optimal_comm);
|
||||||
|
assert(ierr==0);
|
||||||
|
#else
|
||||||
|
////////////////////////////////////////////////////////////////
|
||||||
|
// Assert power of two shm_size.
|
||||||
|
////////////////////////////////////////////////////////////////
|
||||||
|
int log2size = Log2Size(WorldShmSize,MAXLOG2RANKSPERNODE);
|
||||||
assert(log2size != -1);
|
assert(log2size != -1);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////
|
||||||
@@ -175,7 +306,69 @@ void GlobalSharedMemory::OptimalCommunicator(const std::vector<int> &processors,
|
|||||||
/////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////
|
||||||
int ierr= MPI_Comm_split(WorldComm,0,rank,&optimal_comm);
|
int ierr= MPI_Comm_split(WorldComm,0,rank,&optimal_comm);
|
||||||
assert(ierr==0);
|
assert(ierr==0);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// SHMGET
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
#ifdef GRID_MPI3_SHMGET
|
||||||
|
void GlobalSharedMemory::SharedMemoryAllocate(uint64_t bytes, int flags)
|
||||||
|
{
|
||||||
|
std::cout << "SharedMemoryAllocate "<< bytes<< " shmget implementation "<<std::endl;
|
||||||
|
assert(_ShmSetup==1);
|
||||||
|
assert(_ShmAlloc==0);
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// allocate the shared windows for our group
|
||||||
|
//////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
MPI_Barrier(WorldShmComm);
|
||||||
|
WorldShmCommBufs.resize(WorldShmSize);
|
||||||
|
std::vector<int> shmids(WorldShmSize);
|
||||||
|
|
||||||
|
if ( WorldShmRank == 0 ) {
|
||||||
|
for(int r=0;r<WorldShmSize;r++){
|
||||||
|
size_t size = bytes;
|
||||||
|
key_t key = IPC_PRIVATE;
|
||||||
|
int flags = IPC_CREAT | SHM_R | SHM_W;
|
||||||
|
#ifdef SHM_HUGETLB
|
||||||
|
if (Hugepages) flags|=SHM_HUGETLB;
|
||||||
|
#endif
|
||||||
|
if ((shmids[r]= shmget(key,size, flags)) ==-1) {
|
||||||
|
int errsv = errno;
|
||||||
|
printf("Errno %d\n",errsv);
|
||||||
|
printf("key %d\n",key);
|
||||||
|
printf("size %lld\n",size);
|
||||||
|
printf("flags %d\n",flags);
|
||||||
|
perror("shmget");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
MPI_Barrier(WorldShmComm);
|
||||||
|
MPI_Bcast(&shmids[0],WorldShmSize*sizeof(int),MPI_BYTE,0,WorldShmComm);
|
||||||
|
MPI_Barrier(WorldShmComm);
|
||||||
|
|
||||||
|
for(int r=0;r<WorldShmSize;r++){
|
||||||
|
WorldShmCommBufs[r] = (uint64_t *)shmat(shmids[r], NULL,0);
|
||||||
|
if (WorldShmCommBufs[r] == (uint64_t *)-1) {
|
||||||
|
perror("Shared memory attach failure");
|
||||||
|
shmctl(shmids[r], IPC_RMID, NULL);
|
||||||
|
exit(2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
MPI_Barrier(WorldShmComm);
|
||||||
|
///////////////////////////////////
|
||||||
|
// Mark for clean up
|
||||||
|
///////////////////////////////////
|
||||||
|
for(int r=0;r<WorldShmSize;r++){
|
||||||
|
shmctl(shmids[r], IPC_RMID,(struct shmid_ds *)NULL);
|
||||||
|
}
|
||||||
|
MPI_Barrier(WorldShmComm);
|
||||||
|
|
||||||
|
_ShmAlloc=1;
|
||||||
|
_ShmAllocBytes = bytes;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// Hugetlbfs mapping intended
|
// Hugetlbfs mapping intended
|
||||||
@@ -183,7 +376,7 @@ void GlobalSharedMemory::OptimalCommunicator(const std::vector<int> &processors,
|
|||||||
#ifdef GRID_MPI3_SHMMMAP
|
#ifdef GRID_MPI3_SHMMMAP
|
||||||
void GlobalSharedMemory::SharedMemoryAllocate(uint64_t bytes, int flags)
|
void GlobalSharedMemory::SharedMemoryAllocate(uint64_t bytes, int flags)
|
||||||
{
|
{
|
||||||
std::cout << "SharedMemoryAllocate "<< bytes<< " MMAP implementation "<<std::endl;
|
std::cout << "SharedMemoryAllocate "<< bytes<< " MMAP implementation "<< GRID_SHM_PATH <<std::endl;
|
||||||
assert(_ShmSetup==1);
|
assert(_ShmSetup==1);
|
||||||
assert(_ShmAlloc==0);
|
assert(_ShmAlloc==0);
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
@@ -193,7 +386,7 @@ void GlobalSharedMemory::SharedMemoryAllocate(uint64_t bytes, int flags)
|
|||||||
WorldShmCommBufs.resize(WorldShmSize);
|
WorldShmCommBufs.resize(WorldShmSize);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// Hugetlbf and others map filesystems as mappable huge pages
|
// Hugetlbfs and others map filesystems as mappable huge pages
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
char shm_name [NAME_MAX];
|
char shm_name [NAME_MAX];
|
||||||
for(int r=0;r<WorldShmSize;r++){
|
for(int r=0;r<WorldShmSize;r++){
|
||||||
@@ -344,6 +537,9 @@ void GlobalSharedMemory::SharedMemoryAllocate(uint64_t bytes, int flags)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////
|
||||||
// Global shared functionality finished
|
// Global shared functionality finished
|
||||||
// Now move to per communicator functionality
|
// Now move to per communicator functionality
|
||||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+7414
-3244
File diff suppressed because it is too large.
Load diff
File renamed without changes.
File renamed without changes.
@@ -244,19 +244,11 @@ namespace Grid {
|
|||||||
|
|
||||||
template<class sobj,class vobj> strong_inline
|
template<class sobj,class vobj> strong_inline
|
||||||
RealD axpy_norm(Lattice<vobj> &ret,sobj a,const Lattice<vobj> &x,const Lattice<vobj> &y){
|
RealD axpy_norm(Lattice<vobj> &ret,sobj a,const Lattice<vobj> &x,const Lattice<vobj> &y){
|
||||||
ret.checkerboard = x.checkerboard;
|
return axpy_norm_fast(ret,a,x,y);
|
||||||
conformable(ret,x);
|
|
||||||
conformable(x,y);
|
|
||||||
axpy(ret,a,x,y);
|
|
||||||
return norm2(ret);
|
|
||||||
}
|
}
|
||||||
template<class sobj,class vobj> strong_inline
|
template<class sobj,class vobj> strong_inline
|
||||||
RealD axpby_norm(Lattice<vobj> &ret,sobj a,sobj b,const Lattice<vobj> &x,const Lattice<vobj> &y){
|
RealD axpby_norm(Lattice<vobj> &ret,sobj a,sobj b,const Lattice<vobj> &x,const Lattice<vobj> &y){
|
||||||
ret.checkerboard = x.checkerboard;
|
return axpby_norm_fast(ret,a,b,x,y);
|
||||||
conformable(ret,x);
|
|
||||||
conformable(x,y);
|
|
||||||
axpby(ret,a,b,x,y);
|
|
||||||
return norm2(ret); // FIXME implement parallel norm in ss loop
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -33,7 +33,7 @@ namespace Grid {
|
|||||||
// Deterministic Reduction operations
|
// Deterministic Reduction operations
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
template<class vobj> inline RealD norm2(const Lattice<vobj> &arg){
|
template<class vobj> inline RealD norm2(const Lattice<vobj> &arg){
|
||||||
ComplexD nrm = innerProduct(arg,arg);
|
auto nrm = innerProduct(arg,arg);
|
||||||
return std::real(nrm);
|
return std::real(nrm);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -43,32 +43,85 @@ inline ComplexD innerProduct(const Lattice<vobj> &left,const Lattice<vobj> &righ
|
|||||||
{
|
{
|
||||||
typedef typename vobj::scalar_type scalar_type;
|
typedef typename vobj::scalar_type scalar_type;
|
||||||
typedef typename vobj::vector_typeD vector_type;
|
typedef typename vobj::vector_typeD vector_type;
|
||||||
scalar_type nrm;
|
|
||||||
|
|
||||||
GridBase *grid = left._grid;
|
GridBase *grid = left._grid;
|
||||||
|
const int pad = 8;
|
||||||
|
|
||||||
std::vector<vector_type,alignedAllocator<vector_type> > sumarray(grid->SumArraySize());
|
ComplexD inner;
|
||||||
|
Vector<ComplexD> sumarray(grid->SumArraySize()*pad);
|
||||||
|
|
||||||
parallel_for(int thr=0;thr<grid->SumArraySize();thr++){
|
parallel_for(int thr=0;thr<grid->SumArraySize();thr++){
|
||||||
int nwork, mywork, myoff;
|
int nwork, mywork, myoff;
|
||||||
GridThread::GetWork(left._grid->oSites(),thr,mywork,myoff);
|
GridThread::GetWork(left._grid->oSites(),thr,mywork,myoff);
|
||||||
|
|
||||||
decltype(innerProductD(left._odata[0],right._odata[0])) vnrm=zero; // private to thread; sub summation
|
decltype(innerProductD(left._odata[0],right._odata[0])) vinner=zero; // private to thread; sub summation
|
||||||
for(int ss=myoff;ss<mywork+myoff; ss++){
|
for(int ss=myoff;ss<mywork+myoff; ss++){
|
||||||
vnrm = vnrm + innerProductD(left._odata[ss],right._odata[ss]);
|
vinner = vinner + innerProductD(left._odata[ss],right._odata[ss]);
|
||||||
}
|
}
|
||||||
sumarray[thr]=TensorRemove(vnrm) ;
|
// All threads sum across SIMD; reduce serial work at end
|
||||||
|
// one write per cacheline with streaming store
|
||||||
|
ComplexD tmp = Reduce(TensorRemove(vinner)) ;
|
||||||
|
vstream(sumarray[thr*pad],tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
vector_type vvnrm; vvnrm=zero; // sum across threads
|
inner=0.0;
|
||||||
for(int i=0;i<grid->SumArraySize();i++){
|
for(int i=0;i<grid->SumArraySize();i++){
|
||||||
vvnrm = vvnrm+sumarray[i];
|
inner = inner+sumarray[i*pad];
|
||||||
}
|
}
|
||||||
nrm = Reduce(vvnrm);// sum across simd
|
right._grid->GlobalSum(inner);
|
||||||
right._grid->GlobalSum(nrm);
|
return inner;
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////////////////////
|
||||||
|
// Fast axpby_norm
|
||||||
|
// z = a x + b y
|
||||||
|
// return norm z
|
||||||
|
/////////////////////////
|
||||||
|
template<class sobj,class vobj> strong_inline RealD
|
||||||
|
axpy_norm_fast(Lattice<vobj> &z,sobj a,const Lattice<vobj> &x,const Lattice<vobj> &y)
|
||||||
|
{
|
||||||
|
sobj one(1.0);
|
||||||
|
return axpby_norm_fast(z,a,one,x,y);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class sobj,class vobj> strong_inline RealD
|
||||||
|
axpby_norm_fast(Lattice<vobj> &z,sobj a,sobj b,const Lattice<vobj> &x,const Lattice<vobj> &y)
|
||||||
|
{
|
||||||
|
const int pad = 8;
|
||||||
|
z.checkerboard = x.checkerboard;
|
||||||
|
conformable(z,x);
|
||||||
|
conformable(x,y);
|
||||||
|
|
||||||
|
typedef typename vobj::scalar_type scalar_type;
|
||||||
|
typedef typename vobj::vector_typeD vector_type;
|
||||||
|
RealD nrm;
|
||||||
|
|
||||||
|
GridBase *grid = x._grid;
|
||||||
|
|
||||||
|
Vector<RealD> sumarray(grid->SumArraySize()*pad);
|
||||||
|
|
||||||
|
parallel_for(int thr=0;thr<grid->SumArraySize();thr++){
|
||||||
|
int nwork, mywork, myoff;
|
||||||
|
GridThread::GetWork(x._grid->oSites(),thr,mywork,myoff);
|
||||||
|
|
||||||
|
// private to thread; sub summation
|
||||||
|
decltype(innerProductD(z._odata[0],z._odata[0])) vnrm=zero;
|
||||||
|
for(int ss=myoff;ss<mywork+myoff; ss++){
|
||||||
|
vobj tmp = a*x._odata[ss]+b*y._odata[ss];
|
||||||
|
vnrm = vnrm + innerProductD(tmp,tmp);
|
||||||
|
vstream(z._odata[ss],tmp);
|
||||||
|
}
|
||||||
|
vstream(sumarray[thr*pad],real(Reduce(TensorRemove(vnrm)))) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
nrm = 0.0; // sum across threads; linear in thread count but fast
|
||||||
|
for(int i=0;i<grid->SumArraySize();i++){
|
||||||
|
nrm = nrm+sumarray[i*pad];
|
||||||
|
}
|
||||||
|
z._grid->GlobalSum(nrm);
|
||||||
return nrm;
|
return nrm;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Op,class T1>
|
template<class Op,class T1>
|
||||||
inline auto sum(const LatticeUnaryExpression<Op,T1> & expr)
|
inline auto sum(const LatticeUnaryExpression<Op,T1> & expr)
|
||||||
->typename decltype(expr.first.func(eval(0,std::get<0>(expr.second))))::scalar_object
|
->typename decltype(expr.first.func(eval(0,std::get<0>(expr.second))))::scalar_object
|
||||||
@@ -221,6 +274,115 @@ template<class vobj> inline void sliceSum(const Lattice<vobj> &Data,std::vector<
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<class vobj>
|
||||||
|
static void mySliceInnerProductVector( std::vector<ComplexD> & result, const Lattice<vobj> &lhs,const Lattice<vobj> &rhs,int orthogdim)
|
||||||
|
{
|
||||||
|
// std::cout << GridLogMessage << "Start mySliceInnerProductVector" << std::endl;
|
||||||
|
|
||||||
|
typedef typename vobj::scalar_type scalar_type;
|
||||||
|
std::vector<scalar_type> lsSum;
|
||||||
|
localSliceInnerProductVector(result, lhs, rhs, lsSum, orthogdim);
|
||||||
|
globalSliceInnerProductVector(result, lhs, lsSum, orthogdim);
|
||||||
|
// std::cout << GridLogMessage << "End mySliceInnerProductVector" << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class vobj>
|
||||||
|
static void localSliceInnerProductVector(std::vector<ComplexD> &result, const Lattice<vobj> &lhs, const Lattice<vobj> &rhs, std::vector<typename vobj::scalar_type> &lsSum, int orthogdim)
|
||||||
|
{
|
||||||
|
// std::cout << GridLogMessage << "Start prep" << std::endl;
|
||||||
|
typedef typename vobj::vector_type vector_type;
|
||||||
|
typedef typename vobj::scalar_type scalar_type;
|
||||||
|
GridBase *grid = lhs._grid;
|
||||||
|
assert(grid!=NULL);
|
||||||
|
conformable(grid,rhs._grid);
|
||||||
|
|
||||||
|
const int Nd = grid->_ndimension;
|
||||||
|
const int Nsimd = grid->Nsimd();
|
||||||
|
|
||||||
|
assert(orthogdim >= 0);
|
||||||
|
assert(orthogdim < Nd);
|
||||||
|
|
||||||
|
int fd=grid->_fdimensions[orthogdim];
|
||||||
|
int ld=grid->_ldimensions[orthogdim];
|
||||||
|
int rd=grid->_rdimensions[orthogdim];
|
||||||
|
// std::cout << GridLogMessage << "Start alloc" << std::endl;
|
||||||
|
|
||||||
|
std::vector<vector_type,alignedAllocator<vector_type> > lvSum(rd); // will locally sum vectors first
|
||||||
|
lsSum.resize(ld,scalar_type(0.0)); // sum across these down to scalars
|
||||||
|
std::vector<iScalar<scalar_type>> extracted(Nsimd); // splitting the SIMD
|
||||||
|
// std::cout << GridLogMessage << "End alloc" << std::endl;
|
||||||
|
|
||||||
|
result.resize(fd); // And then global sum to return the same vector to every node for IO to file
|
||||||
|
for(int r=0;r<rd;r++){
|
||||||
|
lvSum[r]=zero;
|
||||||
|
}
|
||||||
|
|
||||||
|
int e1= grid->_slice_nblock[orthogdim];
|
||||||
|
int e2= grid->_slice_block [orthogdim];
|
||||||
|
int stride=grid->_slice_stride[orthogdim];
|
||||||
|
// std::cout << GridLogMessage << "End prep" << std::endl;
|
||||||
|
// std::cout << GridLogMessage << "Start parallel inner product, _rd = " << rd << std::endl;
|
||||||
|
vector_type vv;
|
||||||
|
parallel_for(int r=0;r<rd;r++)
|
||||||
|
{
|
||||||
|
|
||||||
|
int so=r*grid->_ostride[orthogdim]; // base offset for start of plane
|
||||||
|
|
||||||
|
for(int n=0;n<e1;n++){
|
||||||
|
for(int b=0;b<e2;b++){
|
||||||
|
int ss = so + n * stride + b;
|
||||||
|
vv = TensorRemove(innerProduct(lhs._odata[ss], rhs._odata[ss]));
|
||||||
|
lvSum[r] = lvSum[r] + vv;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// std::cout << GridLogMessage << "End parallel inner product" << std::endl;
|
||||||
|
|
||||||
|
// Sum across simd lanes in the plane, breaking out orthog dir.
|
||||||
|
std::vector<int> icoor(Nd);
|
||||||
|
for(int rt=0;rt<rd;rt++){
|
||||||
|
|
||||||
|
iScalar<vector_type> temp;
|
||||||
|
temp._internal = lvSum[rt];
|
||||||
|
extract(temp,extracted);
|
||||||
|
|
||||||
|
for(int idx=0;idx<Nsimd;idx++){
|
||||||
|
|
||||||
|
grid->iCoorFromIindex(icoor,idx);
|
||||||
|
|
||||||
|
int ldx =rt+icoor[orthogdim]*rd;
|
||||||
|
|
||||||
|
lsSum[ldx]=lsSum[ldx]+extracted[idx]._internal;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// std::cout << GridLogMessage << "End sum over simd lanes" << std::endl;
|
||||||
|
}
|
||||||
|
template <class vobj>
|
||||||
|
static void globalSliceInnerProductVector(std::vector<ComplexD> &result, const Lattice<vobj> &lhs, std::vector<typename vobj::scalar_type> &lsSum, int orthogdim)
|
||||||
|
{
|
||||||
|
typedef typename vobj::scalar_type scalar_type;
|
||||||
|
GridBase *grid = lhs._grid;
|
||||||
|
int fd = result.size();
|
||||||
|
int ld = lsSum.size();
|
||||||
|
// sum over nodes.
|
||||||
|
std::vector<scalar_type> gsum;
|
||||||
|
gsum.resize(fd, scalar_type(0.0));
|
||||||
|
// std::cout << GridLogMessage << "Start of gsum[t] creation:" << std::endl;
|
||||||
|
for(int t=0;t<fd;t++){
|
||||||
|
int pt = t/ld; // processor plane
|
||||||
|
int lt = t%ld;
|
||||||
|
if ( pt == grid->_processor_coor[orthogdim] ) {
|
||||||
|
gsum[t]=lsSum[lt];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// std::cout << GridLogMessage << "End of gsum[t] creation:" << std::endl;
|
||||||
|
// std::cout << GridLogMessage << "Start of GlobalSumVector:" << std::endl;
|
||||||
|
grid->GlobalSumVector(&gsum[0], fd);
|
||||||
|
// std::cout << GridLogMessage << "End of GlobalSumVector:" << std::endl;
|
||||||
|
|
||||||
|
result = gsum;
|
||||||
|
}
|
||||||
template<class vobj>
|
template<class vobj>
|
||||||
static void sliceInnerProductVector( std::vector<ComplexD> & result, const Lattice<vobj> &lhs,const Lattice<vobj> &rhs,int orthogdim)
|
static void sliceInnerProductVector( std::vector<ComplexD> & result, const Lattice<vobj> &lhs,const Lattice<vobj> &rhs,int orthogdim)
|
||||||
{
|
{
|
||||||
@@ -158,10 +158,19 @@ namespace Grid {
|
|||||||
// tens of seconds per trajectory so this is clean in all reasonable cases,
|
// tens of seconds per trajectory so this is clean in all reasonable cases,
|
||||||
// and margin of safety is orders of magnitude.
|
// and margin of safety is orders of magnitude.
|
||||||
// We could hack Sitmo to skip in the higher order words of state if necessary
|
// We could hack Sitmo to skip in the higher order words of state if necessary
|
||||||
|
//
|
||||||
|
// Replace with 2^30 ; avoid problem on large volumes
|
||||||
|
//
|
||||||
/////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////
|
||||||
// uint64_t skip = site+1; // Old init Skipped then drew. Checked compat with faster init
|
// uint64_t skip = site+1; // Old init Skipped then drew. Checked compat with faster init
|
||||||
|
const int shift = 30;
|
||||||
|
|
||||||
uint64_t skip = site;
|
uint64_t skip = site;
|
||||||
skip = skip<<40;
|
|
||||||
|
skip = skip<<shift;
|
||||||
|
|
||||||
|
assert((skip >> shift)==site); // check for overflow
|
||||||
|
|
||||||
eng.discard(skip);
|
eng.discard(skip);
|
||||||
// std::cout << " Engine " <<site << " state " <<eng<<std::endl;
|
// std::cout << " Engine " <<site << " state " <<eng<<std::endl;
|
||||||
}
|
}
|
||||||
@@ -308,6 +317,19 @@ namespace Grid {
|
|||||||
std::seed_seq src(seeds.begin(),seeds.end());
|
std::seed_seq src(seeds.begin(),seeds.end());
|
||||||
Seed(src,0);
|
Seed(src,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SeedUniqueString(const std::string &s){
|
||||||
|
std::vector<int> seeds;
|
||||||
|
std::stringstream sha;
|
||||||
|
seeds = GridChecksum::sha256_seeds(s);
|
||||||
|
for(int i=0;i<seeds.size();i++) {
|
||||||
|
sha << std::hex << seeds[i];
|
||||||
|
}
|
||||||
|
std::cout << GridLogMessage << "Intialising serial RNG with unique string '"
|
||||||
|
<< s << "'" << std::endl;
|
||||||
|
std::cout << GridLogMessage << "Seed SHA256: " << sha.str() << std::endl;
|
||||||
|
SeedFixedIntegers(seeds);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class GridParallelRNG : public GridRNGbase {
|
class GridParallelRNG : public GridRNGbase {
|
||||||
@@ -368,6 +390,18 @@ namespace Grid {
|
|||||||
_time_counter += usecond()- inner_time_counter;
|
_time_counter += usecond()- inner_time_counter;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void SeedUniqueString(const std::string &s){
|
||||||
|
std::vector<int> seeds;
|
||||||
|
std::stringstream sha;
|
||||||
|
seeds = GridChecksum::sha256_seeds(s);
|
||||||
|
for(int i=0;i<seeds.size();i++) {
|
||||||
|
sha << std::hex << seeds[i];
|
||||||
|
}
|
||||||
|
std::cout << GridLogMessage << "Intialising parallel RNG with unique string '"
|
||||||
|
<< s << "'" << std::endl;
|
||||||
|
std::cout << GridLogMessage << "Seed SHA256: " << sha.str() << std::endl;
|
||||||
|
SeedFixedIntegers(seeds);
|
||||||
|
}
|
||||||
void SeedFixedIntegers(const std::vector<int> &seeds){
|
void SeedFixedIntegers(const std::vector<int> &seeds){
|
||||||
|
|
||||||
// Everyone generates the same seed_seq based on input seeds
|
// Everyone generates the same seed_seq based on input seeds
|
||||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -86,7 +86,7 @@ protected:
|
|||||||
Colours &Painter;
|
Colours &Painter;
|
||||||
int active;
|
int active;
|
||||||
int timing_mode;
|
int timing_mode;
|
||||||
int topWidth{-1};
|
int topWidth{-1}, chanWidth{-1};
|
||||||
static int timestamp;
|
static int timestamp;
|
||||||
std::string name, topName;
|
std::string name, topName;
|
||||||
std::string COLOUR;
|
std::string COLOUR;
|
||||||
@@ -126,6 +126,7 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
void setTopWidth(const int w) {topWidth = w;}
|
void setTopWidth(const int w) {topWidth = w;}
|
||||||
|
void setChanWidth(const int w) {chanWidth = w;}
|
||||||
|
|
||||||
friend std::ostream& operator<< (std::ostream& stream, Logger& log){
|
friend std::ostream& operator<< (std::ostream& stream, Logger& log){
|
||||||
|
|
||||||
@@ -136,7 +137,12 @@ public:
|
|||||||
stream << std::setw(log.topWidth);
|
stream << std::setw(log.topWidth);
|
||||||
}
|
}
|
||||||
stream << log.topName << log.background()<< " : ";
|
stream << log.topName << log.background()<< " : ";
|
||||||
stream << log.colour() << std::left << log.name << log.background() << " : ";
|
stream << log.colour() << std::left;
|
||||||
|
if (log.chanWidth > 0)
|
||||||
|
{
|
||||||
|
stream << std::setw(log.chanWidth);
|
||||||
|
}
|
||||||
|
stream << log.name << log.background() << " : ";
|
||||||
if ( log.timestamp ) {
|
if ( log.timestamp ) {
|
||||||
log.StopWatch->Stop();
|
log.StopWatch->Stop();
|
||||||
GridTime now = log.StopWatch->Elapsed();
|
GridTime now = log.StopWatch->Elapsed();
|
||||||
@@ -263,7 +263,7 @@ PARALLEL_CRITICAL
|
|||||||
GridBase *grid,
|
GridBase *grid,
|
||||||
std::vector<fobj> &iodata,
|
std::vector<fobj> &iodata,
|
||||||
std::string file,
|
std::string file,
|
||||||
uint64_t offset,
|
uint64_t& offset,
|
||||||
const std::string &format, int control,
|
const std::string &format, int control,
|
||||||
uint32_t &nersc_csum,
|
uint32_t &nersc_csum,
|
||||||
uint32_t &scidac_csuma,
|
uint32_t &scidac_csuma,
|
||||||
@@ -431,14 +431,20 @@ PARALLEL_CRITICAL
|
|||||||
MPI_Abort(MPI_COMM_WORLD, 1); //assert(ierr == 0);
|
MPI_Abort(MPI_COMM_WORLD, 1); //assert(ierr == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::cout << GridLogDebug << "MPI read I/O set view " << file << std::endl;
|
std::cout << GridLogDebug << "MPI write I/O set view " << file << std::endl;
|
||||||
ierr = MPI_File_set_view(fh, disp, mpiObject, fileArray, "native", MPI_INFO_NULL);
|
ierr = MPI_File_set_view(fh, disp, mpiObject, fileArray, "native", MPI_INFO_NULL);
|
||||||
assert(ierr == 0);
|
assert(ierr == 0);
|
||||||
|
|
||||||
std::cout << GridLogDebug << "MPI read I/O write all " << file << std::endl;
|
std::cout << GridLogDebug << "MPI write I/O write all " << file << std::endl;
|
||||||
ierr = MPI_File_write_all(fh, &iodata[0], 1, localArray, &status);
|
ierr = MPI_File_write_all(fh, &iodata[0], 1, localArray, &status);
|
||||||
assert(ierr == 0);
|
assert(ierr == 0);
|
||||||
|
|
||||||
|
MPI_Offset os;
|
||||||
|
MPI_File_get_position(fh, &os);
|
||||||
|
MPI_File_get_byte_offset(fh, os, &disp);
|
||||||
|
offset = disp;
|
||||||
|
|
||||||
|
|
||||||
MPI_File_close(&fh);
|
MPI_File_close(&fh);
|
||||||
MPI_Type_free(&fileArray);
|
MPI_Type_free(&fileArray);
|
||||||
MPI_Type_free(&localArray);
|
MPI_Type_free(&localArray);
|
||||||
@@ -448,7 +454,7 @@ PARALLEL_CRITICAL
|
|||||||
} else {
|
} else {
|
||||||
|
|
||||||
std::cout << GridLogMessage << "IOobject: C++ write I/O " << file << " : "
|
std::cout << GridLogMessage << "IOobject: C++ write I/O " << file << " : "
|
||||||
<< iodata.size() * sizeof(fobj) << " bytes" << std::endl;
|
<< iodata.size() * sizeof(fobj) << " bytes and offset " << offset << std::endl;
|
||||||
|
|
||||||
std::ofstream fout;
|
std::ofstream fout;
|
||||||
fout.exceptions ( std::fstream::failbit | std::fstream::badbit );
|
fout.exceptions ( std::fstream::failbit | std::fstream::badbit );
|
||||||
@@ -495,6 +501,7 @@ PARALLEL_CRITICAL
|
|||||||
exit(1);
|
exit(1);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
offset = fout.tellp();
|
||||||
fout.close();
|
fout.close();
|
||||||
}
|
}
|
||||||
timer.Stop();
|
timer.Stop();
|
||||||
@@ -699,7 +706,6 @@ PARALLEL_CRITICAL
|
|||||||
|
|
||||||
IOobject(w,grid,iodata,file,offset,format,BINARYIO_WRITE|BINARYIO_LEXICOGRAPHIC,
|
IOobject(w,grid,iodata,file,offset,format,BINARYIO_WRITE|BINARYIO_LEXICOGRAPHIC,
|
||||||
nersc_csum,scidac_csuma,scidac_csumb);
|
nersc_csum,scidac_csuma,scidac_csumb);
|
||||||
|
|
||||||
iodata.resize(1);
|
iodata.resize(1);
|
||||||
{
|
{
|
||||||
std::vector<RngStateType> tmp(RngStateCount);
|
std::vector<RngStateType> tmp(RngStateCount);
|
||||||
@@ -182,6 +182,11 @@ class GridLimeReader : public BinaryIO {
|
|||||||
{
|
{
|
||||||
filename= _filename;
|
filename= _filename;
|
||||||
File = fopen(filename.c_str(), "r");
|
File = fopen(filename.c_str(), "r");
|
||||||
|
if (File == nullptr)
|
||||||
|
{
|
||||||
|
std::cerr << "cannot open file '" << filename << "'" << std::endl;
|
||||||
|
abort();
|
||||||
|
}
|
||||||
LimeR = limeCreateReader(File);
|
LimeR = limeCreateReader(File);
|
||||||
}
|
}
|
||||||
/////////////////////////////////////////////
|
/////////////////////////////////////////////
|
||||||
@@ -245,8 +250,7 @@ class GridLimeReader : public BinaryIO {
|
|||||||
////////////////////////////////////////////
|
////////////////////////////////////////////
|
||||||
// Read a generic serialisable object
|
// Read a generic serialisable object
|
||||||
////////////////////////////////////////////
|
////////////////////////////////////////////
|
||||||
template<class serialisable_object>
|
void readLimeObject(std::string &xmlstring,std::string record_name)
|
||||||
void readLimeObject(serialisable_object &object,std::string object_name,std::string record_name)
|
|
||||||
{
|
{
|
||||||
// should this be a do while; can we miss a first record??
|
// should this be a do while; can we miss a first record??
|
||||||
while ( limeReaderNextRecord(LimeR) == LIME_SUCCESS ) {
|
while ( limeReaderNextRecord(LimeR) == LIME_SUCCESS ) {
|
||||||
@@ -261,15 +265,23 @@ class GridLimeReader : public BinaryIO {
|
|||||||
limeReaderReadData((void *)&xmlc[0], &nbytes, LimeR);
|
limeReaderReadData((void *)&xmlc[0], &nbytes, LimeR);
|
||||||
// std::cout << GridLogMessage<< " readLimeObject matches XML " << &xmlc[0] <<std::endl;
|
// std::cout << GridLogMessage<< " readLimeObject matches XML " << &xmlc[0] <<std::endl;
|
||||||
|
|
||||||
std::string xmlstring(&xmlc[0]);
|
xmlstring = std::string(&xmlc[0]);
|
||||||
XmlReader RD(xmlstring, true, "");
|
|
||||||
read(RD,object_name,object);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
assert(0);
|
assert(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<class serialisable_object>
|
||||||
|
void readLimeObject(serialisable_object &object,std::string object_name,std::string record_name)
|
||||||
|
{
|
||||||
|
std::string xmlstring;
|
||||||
|
|
||||||
|
readLimeObject(xmlstring, record_name);
|
||||||
|
XmlReader RD(xmlstring, true, "");
|
||||||
|
read(RD,object_name,object);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class GridLimeWriter : public BinaryIO
|
class GridLimeWriter : public BinaryIO
|
||||||
@@ -320,16 +332,11 @@ class GridLimeWriter : public BinaryIO
|
|||||||
////////////////////////////////////////////
|
////////////////////////////////////////////
|
||||||
// Write a generic serialisable object
|
// Write a generic serialisable object
|
||||||
////////////////////////////////////////////
|
////////////////////////////////////////////
|
||||||
template<class serialisable_object>
|
void writeLimeObject(int MB,int ME,XmlWriter &writer,std::string object_name,std::string record_name)
|
||||||
void writeLimeObject(int MB,int ME,serialisable_object &object,std::string object_name,std::string record_name)
|
|
||||||
{
|
{
|
||||||
if ( boss_node ) {
|
if ( boss_node ) {
|
||||||
std::string xmlstring;
|
std::string xmlstring = writer.docString();
|
||||||
{
|
|
||||||
XmlWriter WR("","");
|
|
||||||
write(WR,object_name,object);
|
|
||||||
xmlstring = WR.XmlString();
|
|
||||||
}
|
|
||||||
// std::cout << "WriteLimeObject" << record_name <<std::endl;
|
// std::cout << "WriteLimeObject" << record_name <<std::endl;
|
||||||
uint64_t nbytes = xmlstring.size();
|
uint64_t nbytes = xmlstring.size();
|
||||||
// std::cout << " xmlstring "<< nbytes<< " " << xmlstring <<std::endl;
|
// std::cout << " xmlstring "<< nbytes<< " " << xmlstring <<std::endl;
|
||||||
@@ -343,6 +350,20 @@ class GridLimeWriter : public BinaryIO
|
|||||||
limeDestroyHeader(h);
|
limeDestroyHeader(h);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<class serialisable_object>
|
||||||
|
void writeLimeObject(int MB,int ME,serialisable_object &object,std::string object_name,std::string record_name, const unsigned int scientificPrec = 0)
|
||||||
|
{
|
||||||
|
XmlWriter WR("","");
|
||||||
|
|
||||||
|
if (scientificPrec)
|
||||||
|
{
|
||||||
|
WR.scientificFormat(true);
|
||||||
|
WR.setPrecision(scientificPrec);
|
||||||
|
}
|
||||||
|
write(WR,object_name,object);
|
||||||
|
writeLimeObject(MB, ME, WR, object_name, record_name);
|
||||||
|
}
|
||||||
////////////////////////////////////////////////////
|
////////////////////////////////////////////////////
|
||||||
// Write a generic lattice field and csum
|
// Write a generic lattice field and csum
|
||||||
// This routine is Collectively called by all nodes
|
// This routine is Collectively called by all nodes
|
||||||
@@ -449,7 +470,8 @@ class ScidacWriter : public GridLimeWriter {
|
|||||||
// Write generic lattice field in scidac format
|
// Write generic lattice field in scidac format
|
||||||
////////////////////////////////////////////////
|
////////////////////////////////////////////////
|
||||||
template <class vobj, class userRecord>
|
template <class vobj, class userRecord>
|
||||||
void writeScidacFieldRecord(Lattice<vobj> &field,userRecord _userRecord)
|
void writeScidacFieldRecord(Lattice<vobj> &field,userRecord _userRecord,
|
||||||
|
const unsigned int recordScientificPrec = 0)
|
||||||
{
|
{
|
||||||
GridBase * grid = field._grid;
|
GridBase * grid = field._grid;
|
||||||
|
|
||||||
@@ -467,7 +489,7 @@ class ScidacWriter : public GridLimeWriter {
|
|||||||
//////////////////////////////////////////////
|
//////////////////////////////////////////////
|
||||||
if ( this->boss_node ) {
|
if ( this->boss_node ) {
|
||||||
writeLimeObject(1,0,header ,std::string("FieldMetaData"),std::string(GRID_FORMAT)); // Open message
|
writeLimeObject(1,0,header ,std::string("FieldMetaData"),std::string(GRID_FORMAT)); // Open message
|
||||||
writeLimeObject(0,0,_userRecord,_userRecord.SerialisableClassName(),std::string(SCIDAC_RECORD_XML));
|
writeLimeObject(0,0,_userRecord,_userRecord.SerialisableClassName(),std::string(SCIDAC_RECORD_XML), recordScientificPrec);
|
||||||
writeLimeObject(0,0,_scidacRecord,_scidacRecord.SerialisableClassName(),std::string(SCIDAC_PRIVATE_RECORD_XML));
|
writeLimeObject(0,0,_scidacRecord,_scidacRecord.SerialisableClassName(),std::string(SCIDAC_PRIVATE_RECORD_XML));
|
||||||
}
|
}
|
||||||
// Collective call
|
// Collective call
|
||||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -49,7 +49,8 @@ inline double usecond(void) {
|
|||||||
|
|
||||||
typedef std::chrono::system_clock GridClock;
|
typedef std::chrono::system_clock GridClock;
|
||||||
typedef std::chrono::time_point<GridClock> GridTimePoint;
|
typedef std::chrono::time_point<GridClock> GridTimePoint;
|
||||||
typedef std::chrono::milliseconds GridTime;
|
typedef std::chrono::milliseconds GridMillisecs;
|
||||||
|
typedef std::chrono::microseconds GridTime;
|
||||||
typedef std::chrono::microseconds GridUsecs;
|
typedef std::chrono::microseconds GridUsecs;
|
||||||
|
|
||||||
inline std::ostream& operator<< (std::ostream & stream, const std::chrono::milliseconds & time)
|
inline std::ostream& operator<< (std::ostream & stream, const std::chrono::milliseconds & time)
|
||||||
@@ -57,6 +58,11 @@ inline std::ostream& operator<< (std::ostream & stream, const std::chrono::milli
|
|||||||
stream << time.count()<<" ms";
|
stream << time.count()<<" ms";
|
||||||
return stream;
|
return stream;
|
||||||
}
|
}
|
||||||
|
inline std::ostream& operator<< (std::ostream & stream, const std::chrono::microseconds & time)
|
||||||
|
{
|
||||||
|
stream << time.count()<<" usec";
|
||||||
|
return stream;
|
||||||
|
}
|
||||||
|
|
||||||
class GridStopWatch {
|
class GridStopWatch {
|
||||||
private:
|
private:
|
||||||
@@ -96,6 +102,9 @@ public:
|
|||||||
assert(running == false);
|
assert(running == false);
|
||||||
return (uint64_t) accumulator.count();
|
return (uint64_t) accumulator.count();
|
||||||
}
|
}
|
||||||
|
bool isRunning(void){
|
||||||
|
return running;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loaded 100 of 563 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user