Skip to content

Commit

Permalink
examples/filters: add missing starpu_data_unregister
Browse files Browse the repository at this point in the history
  • Loading branch information
nfurmento committed Oct 18, 2024
1 parent 638448b commit ca84897
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 13 deletions.
22 changes: 12 additions & 10 deletions examples/filters/fmultiple_gpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,23 @@
* See the GNU Lesser General Public License in COPYING.LGPL for more details.
*/

#define MATRIX_REGISTER \
unsigned node; \
#define MATRIX_REGISTER \
unsigned node; \
if (starpu_memory_nodes_get_count_by_kind(STARPU_CUDA_RAM) >= 1) \
starpu_memory_node_get_ids_by_type(STARPU_CUDA_RAM, &node, 1); \
else if (starpu_memory_nodes_get_count_by_kind(STARPU_HIP_RAM) >= 1) \
starpu_memory_node_get_ids_by_type(STARPU_HIP_RAM, &node, 1); \
else { \
unsigned nodes[2]; \
else \
{ \
unsigned nodes[2]; \
unsigned nram = starpu_memory_node_get_ids_by_type(STARPU_CPU_RAM, nodes, 2); \
if (nram == 1) \
node = nodes[0]; \
else \
node = nodes[1]; \
} \
if (nram == 1) \
node = nodes[0]; \
else \
node = nodes[1]; \
} \
uintptr_t matrix = starpu_malloc_on_node(node, NX*NY*sizeof(int)); \
starpu_matrix_data_register(&handle, node, matrix, NX, NX, NY, sizeof(int));
#define MATRIX_FREE \

#define MATRIX_FREE \
starpu_free_on_node(node, matrix, NX*NY*sizeof(int));
7 changes: 4 additions & 3 deletions examples/filters/fmultiple_submit_readonly.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@

void matrix_fill(void *buffers[], void *cl_arg)
{
unsigned i, j;
size_t i, j;
(void)cl_arg;

/* length of the matrix */
Expand Down Expand Up @@ -69,7 +69,7 @@ struct starpu_codelet cl_fill =
void fmultiple_check_scale(void *buffers[], void *cl_arg)
{
int start, factor;
unsigned i, j;
size_t i, j;

/* length of the matrix */
size_t nx = STARPU_MATRIX_GET_NX(buffers[0]);
Expand Down Expand Up @@ -117,7 +117,7 @@ struct starpu_codelet cl_check_scale =
void fmultiple_check(void *buffers[], void *cl_arg)
{
int start, factor;
unsigned i, j;
size_t i, j;

/* length of the matrix */
size_t nx = STARPU_MATRIX_GET_NX(buffers[0]);
Expand Down Expand Up @@ -399,6 +399,7 @@ int main(void)
*/
starpu_data_partition_clean(handle, PARTS, vert_handle);
starpu_data_partition_clean(handle, PARTS, horiz_handle);
starpu_data_unregister(handle);
#ifdef MATRIX_FREE
MATRIX_FREE
#endif
Expand Down

0 comments on commit ca84897

Please sign in to comment.