Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix interface naming: qv_thread to qv_pthread. #211

Merged
merged 1 commit into from
Jul 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions include/quo-vadis-pthread.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ typedef struct {
qv_scope_t *scope;
void *(*thread_routine)(void *);
void *arg;
} qv_thread_args_t;
} qv_pthread_args_t;

void *
qv_thread_routine(
qv_pthread_routine(
void *arg
);

Expand All @@ -48,7 +48,7 @@ qv_pthread_create(
);

int
qv_thread_scope_split_at(
qv_pthread_scope_split_at(
qv_scope_t *scope,
qv_hw_obj_type_t type,
int *color_array,
Expand All @@ -57,7 +57,7 @@ qv_thread_scope_split_at(
);

int
qv_thread_scope_split(
qv_pthread_scope_split(
qv_scope_t *scope,
int npieces,
int *color_array,
Expand Down
14 changes: 7 additions & 7 deletions src/quo-vadis-pthread.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include "qvi-utils.h"

int
qv_thread_scope_split(
qv_pthread_scope_split(
qv_scope_t *scope,
int npieces,
int *color_array,
Expand All @@ -36,7 +36,7 @@ qv_thread_scope_split(
}

int
qv_thread_scope_split_at(
qv_pthread_scope_split_at(
qv_scope_t *scope,
qv_hw_obj_type_t type,
int *color_array,
Expand All @@ -49,10 +49,10 @@ qv_thread_scope_split_at(
}

void *
qv_thread_routine(
qv_pthread_routine(
void *arg
) {
qv_thread_args_t *arg_ptr = (qv_thread_args_t *)arg;
qv_pthread_args_t *arg_ptr = (qv_pthread_args_t *)arg;
qvi_scope_bind_push(arg_ptr->scope);

void *ret = arg_ptr->thread_routine(arg_ptr->arg);
Expand All @@ -71,16 +71,16 @@ qv_pthread_create(
void *arg,
qv_scope_t *scope
) {
// Memory will be freed in qv_thread_routine to avoid memory leaks.
qv_thread_args_t *arg_ptr = nullptr;
// Memory will be freed in qv_pthread_routine to avoid memory leaks.
qv_pthread_args_t *arg_ptr = nullptr;
int rc = qvi_new(&arg_ptr);
if (rc != QV_SUCCESS) return rc;

arg_ptr->scope = scope;
arg_ptr->thread_routine = thread_routine;
arg_ptr->arg = arg;

return pthread_create(thread, attr, qv_thread_routine, arg_ptr);
return pthread_create(thread, attr, qv_pthread_routine, arg_ptr);
}

/*
Expand Down
12 changes: 6 additions & 6 deletions tests/test-pthread-split.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ main(void)
qvi_test_panic("%s (rc=%s)", ers, qv_strerr(rc));
}

//test qv_thread_scope_split
//test qv_pthread_scope_split
int npieces = n_cores / 2;
int nthreads = n_cores;

Expand All @@ -81,9 +81,9 @@ main(void)
colors[i] = i % npieces;

qv_scope_t **th_scopes = NULL;
rc = qv_thread_scope_split(mpi_scope, npieces , colors , nthreads, &th_scopes);
rc = qv_pthread_scope_split(mpi_scope, npieces , colors , nthreads, &th_scopes);
if (rc != QV_SUCCESS) {
ers = "qv_thread_scope_split() failed";
ers = "qv_pthread_scope_split() failed";
qvi_test_panic("%s (rc=%s)", ers, qv_strerr(rc));
}

Expand Down Expand Up @@ -119,7 +119,7 @@ main(void)
// API.
//free(th_scopes);

//Test qv_thread_scope_split_at
//Test qv_pthread_scope_split_at
nthreads = 2*n_cores;

fprintf(stdout,"[%d] ====== Testing thread_scope_split_at (number of threads : %i)\n", wrank, nthreads);
Expand All @@ -128,9 +128,9 @@ main(void)
for(int i = 0 ; i < nthreads ; i++)
colors2[i] = i%n_cores;

rc = qv_thread_scope_split_at(mpi_scope, QV_HW_OBJ_CORE, colors2, nthreads, &th_scopes);
rc = qv_pthread_scope_split_at(mpi_scope, QV_HW_OBJ_CORE, colors2, nthreads, &th_scopes);
if (rc != QV_SUCCESS) {
ers = "qv_thread_scope_split_at() failed";
ers = "qv_pthread_scope_split_at() failed";
qvi_test_panic("%s (rc=%s)", ers, qv_strerr(rc));
}

Expand Down
Loading