Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
O
openfpm_pdata
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Environments
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
openfpm
openfpm_pdata
Commits
45a0f1ab
Commit
45a0f1ab
authored
Jun 08, 2019
by
incardon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding missing files
parent
81bef333
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
120 additions
and
0 deletions
+120
-0
src/Vector/cuda/vector_dist_operators_list_ker.hpp
src/Vector/cuda/vector_dist_operators_list_ker.hpp
+120
-0
No files found.
src/Vector/cuda/vector_dist_operators_list_ker.hpp
0 → 100644
View file @
45a0f1ab
/*
* vector_dist_operators_list_ker.hpp
*
* Created on: Jun 7, 2019
* Author: i-bird
*/
#ifndef VECTOR_DIST_OPERATORS_LIST_KER_HPP_
#define VECTOR_DIST_OPERATORS_LIST_KER_HPP_
template
<
typename
T
>
struct
ref_wrap
{
T
&
v
;
ref_wrap
(
T
&
v
)
:
v
(
v
)
{}
ref_wrap
&
operator
=
(
const
ref_wrap
<
T
>
&
rw
)
{
v
=
rw
.
v
;
return
*
this
;
}
};
/*! \brief This class contain a list of all tracked vector_dist_ker around.
*
* In short suppose to do a auto vdk = vd.toKernel() vdk wrap the cuda pointer of vd. On the other hand
* if in vd we use instruction that produce reallocations vdk contain invalid pointers. this class contail a
* list of all vector_dist_kernel, such that if a reallocation happen the pointer are updated on the vector_dist_kernel
*
*/
template
<
typename
vector_dist_ker_type
>
class
vector_dist_ker_list
{
openfpm
::
vector
<
ref_wrap
<
vector_dist_ker_type
>>
vkers
;
public:
/*! \brief Add a new vector_dist_kernel to track
*
* \param v vector_dist_kernel to track
*
*
*/
void
add
(
vector_dist_ker_type
&
v
)
{
ref_wrap
<
vector_dist_ker_type
>
rw
(
v
);
vkers
.
add
(
rw
);
if
(
vkers
.
size
()
>=
64
)
{
std
::
cout
<<
__FILE__
<<
":"
<<
__LINE__
<<
" The array of tracked vector_dist_ker become suspiciously big, are there memory leak ? "
<<
std
::
endl
;
}
}
/*! \brief Update the addresses of all vector_dist_kernels around
*
* \param v vector_dist_kernel to track
*
*
*/
void
update
(
const
vector_dist_ker_type
&
v
)
{
for
(
size_t
i
=
0
;
i
<
vkers
.
size
()
;
i
++
)
{
vkers
.
get
(
i
).
v
=
v
;
}
}
/*! \brief Remove one vector_dist_kernels entry
*
* \param v vector_dist_kernel to remove
*
*
*/
void
remove
(
vector_dist_ker_type
&
v
)
{
for
(
size_t
i
=
0
;
i
<
vkers
.
size
()
;
i
++
)
{
if
(
&
vkers
.
get
(
i
).
v
==
&
v
)
{
vkers
.
remove
(
i
);
break
;
}
}
}
/*! \brief Return the number of entries
*
* \return the number of entries
*
*/
size_t
n_entry
()
{
return
vkers
.
size
();
}
/*! \brief Check that all the entries are aligned to the latest vector_dist_ker_type
*
* \return true if all entries are alligned
*
*/
bool
check
(
const
vector_dist_ker_type
&
v
)
{
for
(
size_t
i
=
0
;
i
<
vkers
.
size
()
;
i
++
)
{
if
(
!
(
vkers
.
get
(
i
).
v
==
v
))
{
return
false
;
}
}
return
true
;
}
};
#endif
/* VECTOR_DIST_OPERATORS_LIST_KER_HPP_ */
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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