-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Checkpoint first cut at pthread group support. (#233)
Still needs plenty of work. Signed-off-by: Samuel K. Gutierrez <[email protected]>
- Loading branch information
1 parent
14a5151
commit 487a055
Showing
16 changed files
with
544 additions
and
221 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/* -*- Mode: C++; c-basic-offset:4; indent-tabs-mode:nil -*- */ | ||
/* | ||
* Copyright (c) 2020-2024 Triad National Security, LLC | ||
* All rights reserved. | ||
* | ||
* This file is part of the quo-vadis project. See the LICENSE file at the | ||
* top-level directory of this distribution. | ||
*/ | ||
|
||
/** | ||
* @file qvi-group-pthread.cc | ||
*/ | ||
|
||
#include "qvi-group-pthread.h" | ||
#include "qvi-utils.h" | ||
|
||
int | ||
qvi_group_pthread_s::self( | ||
qvi_group_t **child | ||
) { | ||
constexpr int group_size = 1; | ||
qvi_group_pthread_t *ichild = nullptr; | ||
int rc = qvi_new(&ichild); | ||
if (rc != QV_SUCCESS) goto out; | ||
// Create a group containing a single thread. | ||
rc = qvi_new(&ichild->thgroup, group_size); | ||
out: | ||
if (rc != QV_SUCCESS) { | ||
qvi_delete(&ichild); | ||
} | ||
*child = ichild; | ||
return rc; | ||
} | ||
|
||
int | ||
qvi_group_pthread_s::split( | ||
int, | ||
int, | ||
qvi_group_t ** | ||
) { | ||
// TODO(skg) | ||
return QV_ERR_NOT_SUPPORTED; | ||
} | ||
|
||
qvi_zgroup_pthread_s::qvi_zgroup_pthread_s( | ||
int group_size | ||
) { | ||
int rc = qvi_new(&thgroup, group_size); | ||
if (rc != QV_SUCCESS) throw qvi_runtime_error(); | ||
} | ||
|
||
/* | ||
* vim: ft=cpp ts=4 sts=4 sw=4 expandtab | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
/* -*- Mode: C++; c-basic-offset:4; indent-tabs-mode:nil -*- */ | ||
/* | ||
* Copyright (c) 2020-2024 Triad National Security, LLC | ||
* All rights reserved. | ||
* | ||
* This file is part of the quo-vadis project. See the LICENSE file at the | ||
* top-level directory of this distribution. | ||
*/ | ||
|
||
/** | ||
* @file qvi-group-pthread.h | ||
*/ | ||
|
||
#ifndef QVI_GROUP_PTHREAD_H | ||
#define QVI_GROUP_PTHREAD_H | ||
|
||
#include "qvi-common.h" | ||
#include "qvi-group.h" | ||
#include "qvi-pthread.h" | ||
|
||
struct qvi_group_pthread_s : public qvi_group_s { | ||
/** Underlying group instance. */ | ||
qvi_pthread_group_t *thgroup = nullptr; | ||
/** Constructor. */ | ||
qvi_group_pthread_s(void) = default; | ||
/** Destructor. */ | ||
virtual ~qvi_group_pthread_s(void) | ||
{ | ||
qvi_delete(&thgroup); | ||
} | ||
|
||
virtual qvi_task_t * | ||
task(void) | ||
{ | ||
return thgroup->task(); | ||
} | ||
|
||
virtual int | ||
rank(void) | ||
{ | ||
return thgroup->rank(); | ||
} | ||
|
||
virtual int | ||
size(void) | ||
{ | ||
return thgroup->size(); | ||
} | ||
|
||
virtual int | ||
barrier(void) | ||
{ | ||
return thgroup->barrier(); | ||
} | ||
|
||
virtual int | ||
make_intrinsic( | ||
qv_scope_intrinsic_t | ||
) { | ||
// Nothing to do. | ||
return QV_SUCCESS; | ||
} | ||
|
||
virtual int | ||
self( | ||
qvi_group_s **child | ||
); | ||
|
||
virtual int | ||
thsplit( | ||
int, | ||
qvi_group_s ** | ||
) { | ||
// TODO(skg) Need to test this. | ||
return QV_ERR_NOT_SUPPORTED; | ||
} | ||
|
||
virtual int | ||
split( | ||
int color, | ||
int key, | ||
qvi_group_s **child | ||
); | ||
|
||
virtual int | ||
gather( | ||
qvi_bbuff_t *txbuff, | ||
int root, | ||
bool *shared, | ||
qvi_bbuff_t ***rxbuffs | ||
) { | ||
return thgroup->gather_bbuffs( | ||
txbuff, root, shared, rxbuffs | ||
); | ||
} | ||
|
||
virtual int | ||
scatter( | ||
qvi_bbuff_t **txbuffs, | ||
int root, | ||
qvi_bbuff_t **rxbuff | ||
) { | ||
return thgroup->scatter_bbuffs( | ||
txbuffs, root, rxbuff | ||
); | ||
} | ||
}; | ||
typedef qvi_group_pthread_s qvi_group_pthread_t; | ||
|
||
struct qvi_zgroup_pthread_s : public qvi_group_pthread_s { | ||
/** Default constructor. */ | ||
qvi_zgroup_pthread_s(void) = delete; | ||
/** Constructor. */ | ||
qvi_zgroup_pthread_s( | ||
int group_size | ||
); | ||
}; | ||
|
||
#endif | ||
|
||
/* | ||
* vim: ft=cpp ts=4 sts=4 sw=4 expandtab | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/* -*- Mode: C++; c-basic-offset:4; indent-tabs-mode:nil -*- */ | ||
/* | ||
* Copyright (c) 2021-2024 Triad National Security, LLC | ||
* All rights reserved. | ||
* | ||
* This file is part of the quo-vadis project. See the LICENSE file at the | ||
* top-level directory of this distribution. | ||
*/ | ||
|
||
/** | ||
* @file qvi-group.cc | ||
*/ | ||
|
||
#include "qvi-group.h" | ||
#include "qvi-group-pthread.h" | ||
#include "qvi-utils.h" | ||
|
||
int | ||
qvi_group_s::thsplit( | ||
int nthreads, | ||
qvi_group_s **child | ||
) { | ||
qvi_group_pthread_t *ichild = nullptr; | ||
int rc = qvi_new(&ichild); | ||
if (rc != QV_SUCCESS) goto out; | ||
|
||
rc = qvi_new(&ichild->thgroup, nthreads); | ||
out: | ||
if (rc != QV_SUCCESS) { | ||
qvi_delete(&ichild); | ||
} | ||
*child = ichild; | ||
return rc; | ||
} | ||
|
||
/* | ||
* vim: ft=cpp ts=4 sts=4 sw=4 expandtab | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/* -*- Mode: C++; c-basic-offset:4; indent-tabs-mode:nil -*- */ | ||
/* | ||
* Copyright (c) 2024 Triad National Security, LLC | ||
* All rights reserved. | ||
* | ||
* This file is part of the quo-vadis project. See the LICENSE file at the | ||
* top-level directory of this distribution. | ||
*/ | ||
|
||
/** | ||
* @file qvi-pthread.cc | ||
*/ | ||
|
||
#include "qvi-pthread.h" | ||
#include "qvi-bbuff.h" | ||
#include "qvi-utils.h" | ||
#include "qvi-task.h" | ||
|
||
/* | ||
* vim: ft=cpp ts=4 sts=4 sw=4 expandtab | ||
*/ |
Oops, something went wrong.