Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Sbalzarini Lab
S
Software
P
Parallel Computing
OpenFPM
openfpm_devices
Commits
25445ab3
Commit
25445ab3
authored
Feb 04, 2021
by
incardon
Browse files
Adding garbage injector option
parent
5156694a
Pipeline
#2715
passed with stages
in 13 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/config/config_cmake.h.in
View file @
25445ab3
...
...
@@ -174,6 +174,9 @@ ${DEFINE_STDC_HEADERS}
/* If an error occur stop the program */
${DEFINE_STOP_ON_ERROR}
/* Garbage injector*/
${DEFINE_GARBAGE_INJECTOR}
/* Test coverage mode */
${DEFINE_TEST_COVERAGE_MODE}
...
...
src/memory/CudaMemory.cu
View file @
25445ab3
...
...
@@ -43,7 +43,12 @@ bool CudaMemory::allocate(size_t sz)
CUDA_SAFE_CALL
(
cudaMalloc
(
&
dm
,
sz
));
#else
if
(
sz
!=
0
)
{
dm
=
new
unsigned
char
[
sz
];}
{
dm
=
new
unsigned
char
[
sz
];
#ifdef GARBAGE_INJECTOR
memset
(
dm
,
0xFF
,
sz
);
#endif
}
#endif
}
else
...
...
@@ -126,6 +131,9 @@ void CudaMemory::allocate_host(size_t sz) const
CUDA_SAFE_CALL
(
cudaHostAlloc
(
&
hm
,
sz
,
cudaHostAllocMapped
))
#else
hm
=
new
unsigned
char
[
sz
];
#ifdef GARBAGE_INJECTOR
memset
(
hm
,
0xFF
,
sz
);
#endif
#endif
}
}
...
...
@@ -264,6 +272,9 @@ bool CudaMemory::resize(size_t sz)
CUDA_SAFE_CALL
(
cudaMalloc
(
&
tdm
,
sz
));
#else
tdm
=
new
unsigned
char
[
sz
];
#ifdef GARBAGE_INJECTOR
memset
(
tdm
,
0xFF
,
sz
);
#endif
#endif
#ifdef FILL_CUDA_MEMORY_WITH_MINUS_ONE
...
...
@@ -291,6 +302,9 @@ bool CudaMemory::resize(size_t sz)
CUDA_SAFE_CALL
(
cudaHostAlloc
(
&
thm
,
sz
,
cudaHostAllocMapped
));
#else
thm
=
new
unsigned
char
[
sz
];
#ifdef GARBAGE_INJECTOR
memset
(
thm
,
0xFF
,
sz
);
#endif
#endif
}
...
...
src/memory/HeapMemory.cpp
View file @
25445ab3
...
...
@@ -34,7 +34,12 @@ bool HeapMemory::allocate(size_t sz)
{
//! Allocate the device memory
if
(
dm
==
NULL
)
{
dmOrig
=
new
byte
[
sz
+
alignement
+
extra_pad
];}
{
dmOrig
=
new
byte
[
sz
+
alignement
+
extra_pad
];
#ifdef GARBAGE_INJECTOR
memset
(
dmOrig
,
0xFF
,
sz
+
alignement
+
extra_pad
);
#endif
}
else
{
std
::
cerr
<<
__FILE__
<<
":"
<<
__LINE__
<<
" error memory already allocated
\n
"
;
...
...
@@ -174,6 +179,9 @@ bool HeapMemory::resize(size_t sz)
byte
*
tdm
;
byte
*
tdmOrig
;
tdmOrig
=
new
byte
[
sz
+
alignement
+
extra_pad
];
#ifdef GARBAGE_INJECTOR
memset
(
tdmOrig
,
0xFF
,
sz
+
alignement
+
extra_pad
);
#endif
tdm
=
tdmOrig
;
//! size plus alignment
...
...
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