Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
ORNL Quantum Computing Institute
exatn
Commits
9edbfb80
Commit
9edbfb80
authored
Nov 03, 2021
by
Dmitry I. Lyakh
Browse files
Fixed an issue with TensorContraction driver routine
Signed-off-by:
Dmitry I. Lyakh
<
quant4me@gmail.com
>
parent
283fcd6f
Pipeline
#179614
failed with stage
in 5 minutes and 57 seconds
Changes
3
Pipelines
39
Show whitespace changes
Inline
Side-by-side
src/exatn/num_server.hpp
View file @
9edbfb80
/** ExaTN::Numerics: Numerical server
REVISION: 2021/1
0/30
REVISION: 2021/1
1/03
Copyright (C) 2018-2021 Dmitry I. Lyakh (Liakh)
Copyright (C) 2018-2021 Oak Ridge National Laboratory (UT-Battelle) **/
...
...
src/exatn/tests/NumServerTester.cpp
View file @
9edbfb80
...
...
@@ -223,12 +223,12 @@ TEST(NumServerTester, PerformanceExaTN)
//Contract tensors:
std::cout << " Case 5: C=A*B out-of-core small dims: ";
exatn::sync();
success =
exatn::sync();
assert(success);
time_start = exatn::Timer::timeInSecHR();
success = exatn::contractTensors("C(c49,c40,c13,c50,c47,c14,c15,c41,c16,c17,c18,c19,c20,c21,c22,c23,c24,c25,c26,c27,c28,c29,c45,c30,c44,c43,c31,c32,c33,c34,c48,c35,c36,c42,c37,c39,c38,c46)+="
"A(c49,c40,c13,c50,c62,c47,c14,c15,c63,c41,c64,c65,c16,c66,c67,c68,c69,c17,c18,c19,c70,c71,c72,c73,c74,c75)*"
"B(c20,c21,c64,c22,c69,c67,c23,c24,c25,c26,c27,c28,c29,c45,c30,c44,c68,c43,c31,c73,c72,c32,c33,c66,c34,c75,c74,c71,c65,c48,c70,c35,c63,c36,c42,c37,c39,c38,c46,c62)",1.0); assert(success);
exatn::sync();
success =
exatn::sync();
assert(success);
duration = exatn::Timer::timeInSecHR(time_start);
std::cout << "Average performance (GFlop/s) = " << 8.0*1.099512e3/duration << std::endl;
...
...
@@ -237,7 +237,7 @@ TEST(NumServerTester, PerformanceExaTN)
success = exatn::destroyTensor("B"); assert(success);
success = exatn::destroyTensor("A"); assert(success);
exatn::sync(); */
success =
exatn::sync();
assert(success);
*/
std
::
cout
<<
"Tensor decomposition:"
<<
std
::
endl
;
//Create tensors:
...
...
@@ -269,7 +269,7 @@ TEST(NumServerTester, PerformanceExaTN)
success
=
exatn
::
destroyTensor
(
"D"
);
assert
(
success
);
//Synchronize ExaTN server:
exatn
::
sync
();
success
=
exatn
::
sync
();
assert
(
success
);
exatn
::
resetLoggingLevel
(
0
,
0
);
}
#endif
...
...
@@ -305,7 +305,7 @@ TEST(NumServerTester, ExamplarExaTN)
color
=
(
global_rank
+
1
)
/
2
;
if
(
global_rank
==
0
)
color
=
-
1
;
auto
me_plus_prev
=
all_processes
.
split
(
color
);
}
exatn
::
sync
();
success
=
exatn
::
sync
();
assert
(
success
);
//Declare and then create (allocate) a tensor (in two steps):
auto
z2
=
exatn
::
makeSharedTensor
(
"Z2"
,
TensorShape
{
VI_RANGE
,
VI_RANGE
,
OC_RANGE
,
OC_RANGE
});
//declares tensor Z2 with no storage
...
...
@@ -335,7 +335,7 @@ TEST(NumServerTester, ExamplarExaTN)
success
=
exatn
::
contractTensors
(
"ENERGY()+=Y2(a,b,i,j)*Y2(a,b,i,j)"
,
0.25
);
assert
(
success
);
//Synchronize ExaTN server:
exatn
::
sync
();
success
=
exatn
::
sync
();
assert
(
success
);
//Compute 2-norms (synchronously):
double
norm2
=
0.0
;
...
...
@@ -369,7 +369,7 @@ TEST(NumServerTester, ExamplarExaTN)
local_copy
.
reset
();
//Synchronize ExaTN server:
exatn
::
sync
();
success
=
exatn
::
sync
();
assert
(
success
);
//Destroy all tensors:
success
=
exatn
::
destroyTensor
(
"ENERGY"
);
assert
(
success
);
...
...
@@ -382,7 +382,7 @@ TEST(NumServerTester, ExamplarExaTN)
z2
.
reset
();
//Synchronize ExaTN server:
exatn
::
sync
(
all_processes
);
success
=
exatn
::
sync
(
all_processes
);
assert
(
success
);
exatn
::
resetLoggingLevel
(
0
,
0
);
}
#endif
...
...
src/numerics/tensor_op_contract.cpp
View file @
9edbfb80
/** ExaTN::Numerics: Tensor operation: Contracts two tensors and accumulates the result into another tensor
REVISION: 2021/
09/24
REVISION: 2021/
11/03
Copyright (C) 2018-2021 Dmitry I. Lyakh (Liakh)
Copyright (C) 2018-2021 Oak Ridge National Laboratory (UT-Battelle) **/
...
...
@@ -152,6 +152,7 @@ void TensorOpContract::introduceOptTemporaries(unsigned int num_processes,
const
std
::
vector
<
PosIndexLabel
>
&
contr_indices
,
const
std
::
vector
<
PosIndexLabel
>
&
hyper_indices
)
{
if
(
!
this
->
isComposite
())
return
;
//std::cout << "#DEBUG(TensorOpContract::introduceOptTemporaries): Parallel parameters: "
// << num_processes << " " << mem_per_process << std::endl; //debug
assert
(
num_processes
>
0
);
...
...
@@ -305,6 +306,7 @@ void TensorOpContract::introduceOptTemporaries(unsigned int num_processes,
void
TensorOpContract
::
introduceOptTemporaries
(
unsigned
int
num_processes
,
std
::
size_t
mem_per_process
)
{
if
(
this
->
isComposite
()){
std
::
vector
<
std
::
string
>
tensors
;
std
::
vector
<
PosIndexLabel
>
left_inds
,
right_inds
,
contr_inds
,
hyper_inds
;
auto
parsed
=
parse_tensor_contraction
(
getIndexPattern
(),
tensors
,
left_inds
,
right_inds
,
contr_inds
,
hyper_inds
);
...
...
@@ -313,7 +315,10 @@ void TensorOpContract::introduceOptTemporaries(unsigned int num_processes, std::
<<
getIndexPattern
()
<<
std
::
endl
<<
std
::
flush
;
assert
(
false
);
}
//std::cout << "#DEBUG(TensorOpContract:introduceOptTemporaries): Composite tensor contraction detected\n" << std::flush; //debug
return
introduceOptTemporaries
(
num_processes
,
mem_per_process
,
left_inds
,
right_inds
,
contr_inds
,
hyper_inds
);
}
return
;
}
std
::
size_t
TensorOpContract
::
decompose
(
const
TensorMapper
&
tensor_mapper
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment