Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mpim-sw
cdo
Commits
2536df0f
Commit
2536df0f
authored
Nov 01, 2017
by
Uwe Schulzweida
Browse files
kdtree: test BIGMEM.
parent
96a03bdd
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/kdtreelib/kdtree_common.cc
View file @
2536df0f
...
...
@@ -212,6 +212,11 @@ kd_buildArg(struct kd_point *points,
return
d
;
}
//#define TEST_BIGMEM 1
#ifdef TEST_BIGMEM
size_t
num_nodes
=
0
;
struct
kdNode
*
mem_pool
=
NULL
;
#endif
struct
kdNode
*
kd_allocNode
(
struct
kd_point
*
points
,
unsigned
long
pivot
,
...
...
@@ -219,8 +224,13 @@ kd_allocNode(struct kd_point *points, unsigned long pivot,
{
struct
kdNode
*
node
;
#ifdef TEST_BIGMEM
if
(
mem_pool
==
NULL
)
mem_pool
=
(
kdNode
*
)
malloc
(
2
*
25920000
*
sizeof
(
kdNode
));
// 2*gridsize
node
=
&
mem_pool
[
num_nodes
++
];
#else
if
((
node
=
(
kdNode
*
)
kd_malloc
(
sizeof
(
kdNode
),
"kd_allocNode (node): "
))
==
NULL
)
return
NULL
;
#endif
node
->
split
=
axis
;
memcpy
(
node
->
location
,
points
[
pivot
].
point
,
dim
*
sizeof
(
kdata_t
));
...
...
@@ -246,9 +256,17 @@ kd_destroyTree(struct kdNode *node)
{
if
(
node
==
NULL
)
return
;
#ifdef TEST_BIGMEM
if
(
mem_pool
)
{
free
(
mem_pool
);
num_nodes
=
0
;
}
#else
kd_destroyTree
(
node
->
left
);
kd_destroyTree
(
node
->
right
);
kd_freeNode
(
node
);
#endif
}
/* end of tree construction and destruction */
...
...
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