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
99e9a06b
Commit
99e9a06b
authored
Jun 05, 2019
by
Dmitry I. Lyakh
Browse files
Added asynchronous tensor operation processing API into NumServer.
parent
46666be2
Changes
5
Hide whitespace changes
Inline
Side-by-side
src/numerics/num_server.cpp
View file @
99e9a06b
...
...
@@ -96,6 +96,37 @@ void NumServer::destroySubspace(SubspaceId subspace_id)
return
;
}
int
submit
(
std
::
shared_ptr
<
TensorOperation
>
operation
)
{
//`Finish
return
0
;
}
int
submit
(
std
::
shared_ptr
<
TensorNetwork
>
network
)
{
//`Finish
return
0
;
}
bool
sync
(
const
Tensor
&
tensor
,
bool
wait
)
{
//`Finish
return
false
;
}
bool
sync
(
const
TensorOperation
&
operation
,
bool
wait
)
{
//`Finish
return
false
;
}
bool
sync
(
const
TensorNetwork
&
network
,
bool
wait
)
{
//`Finish
return
false
;
}
}
//namespace numerics
}
//namespace exatn
src/numerics/num_server.hpp
View file @
99e9a06b
...
...
@@ -4,6 +4,17 @@ REVISION: 2019/06/05
Copyright (C) 2018-2019 Dmitry I. Lyakh (Liakh)
Copyright (C) 2018-2019 Oak Ridge National Laboratory (UT-Battelle) **/
/** Rationale:
(a) Numerical server provides basic tensor network processing functionality:
+ Opening/closing TAProL scopes (top scope 0 "GLOBAL" is open automatically);
+ Creation/destruction of named vector spaces and their named subspaces;
+ Registration/retrieval of external data;
+ Registration/retrieval of external tensor methods;
+ Submission for processing of individual tensor operations and tensor networks.
(b) Processing of individual tensor operations and tensor networks has asynchronous semantics:
Submit TensorOperation/TensorNetwork for processing, then synchronize on the tensor-result.
**/
#ifndef EXATN_NUMERICS_NUM_SERVER_HPP_
#define EXATN_NUMERICS_NUM_SERVER_HPP_
...
...
@@ -80,6 +91,22 @@ public:
void
destroySubspace
(
const
std
::
string
&
subspace_name
);
//in: name of the subspace to destroy
void
destroySubspace
(
SubspaceId
subspace_id
);
/** Submits an individual tensor operation for processing. **/
int
submit
(
std
::
shared_ptr
<
TensorOperation
>
operation
);
/** Submits a tensor network for processing (evaluating the tensor-result). **/
int
submit
(
std
::
shared_ptr
<
TensorNetwork
>
network
);
/** Synchronizes all tensor operations on a given tensor. **/
bool
sync
(
const
Tensor
&
tensor
,
bool
wait
=
false
);
/** Synchronizes execution of a specific tensor operation. **/
bool
sync
(
const
TensorOperation
&
operation
,
bool
wait
=
false
);
/** Synchronizes execution of a specific tensor network. **/
bool
sync
(
const
TensorNetwork
&
network
,
bool
wait
=
false
);
private:
SpaceRegister
space_register_
;
//register of vector spaces and their named subspaces
...
...
src/numerics/tensor.cpp
View file @
99e9a06b
/** ExaTN::Numerics: Tensor
REVISION: 201
8/12/18
REVISION: 201
9/06/05
Copyright (C) 2018-2018 Dmitry I. Lyakh (Liakh)
Copyright (C) 2018-2018 Oak Ridge National Laboratory (UT-Battelle) **/
...
...
@@ -76,6 +76,11 @@ std::pair<SpaceId,SubspaceId> Tensor::getDimSpaceAttr(unsigned int dim_id) const
return
signature_
.
getDimSpaceAttr
(
dim_id
);
}
std
::
size_t
Tensor
::
getTensorId
()
const
{
return
reinterpret_cast
<
std
::
size_t
>
(
this
);
}
}
//namespace numerics
}
//namespace exatn
src/numerics/tensor.hpp
View file @
99e9a06b
/** ExaTN::Numerics: Abstract Tensor
REVISION: 2019/0
5/27
REVISION: 2019/0
6/05
Copyright (C) 2018-2019 Dmitry I. Lyakh (Liakh)
Copyright (C) 2018-2019 Oak Ridge National Laboratory (UT-Battelle) **/
...
...
@@ -102,6 +102,9 @@ public:
SubspaceId
getDimSubspaceId
(
unsigned
int
dim_id
)
const
;
std
::
pair
<
SpaceId
,
SubspaceId
>
getDimSpaceAttr
(
unsigned
int
dim_id
)
const
;
/** Get the unique integer tensor id. **/
std
::
size_t
getTensorId
()
const
;
private:
std
::
string
name_
;
//tensor name
...
...
src/numerics/tensor_operation.cpp
View file @
99e9a06b
...
...
@@ -48,7 +48,7 @@ unsigned int TensorOperation::getNumOperandsSet() const
std
::
size_t
TensorOperation
::
getTensorOperandId
(
unsigned
int
op_num
)
{
return
reinterpret_cast
<
std
::
size_t
>
(
this
->
getTensorOperand
(
op_num
).
get
());
return
(
(
this
->
getTensorOperand
(
op_num
)
)
.
get
())
->
getTensorId
()
;
}
std
::
shared_ptr
<
Tensor
>
TensorOperation
::
getTensorOperand
(
unsigned
int
op_num
)
...
...
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