Skip to content

Commit fdfcc6c

Browse files
Cleanup some code. (#263)
Signed-off-by: Samuel K. Gutierrez <[email protected]>
1 parent 5c4f257 commit fdfcc6c

11 files changed

+36
-36
lines changed

include/quo-vadis.h

+14-13
Original file line numberDiff line numberDiff line change
@@ -163,16 +163,6 @@ qv_version(
163163
int *patch
164164
);
165165

166-
/**
167-
*
168-
*/
169-
int
170-
qv_scope_nobjs(
171-
qv_scope_t *scope,
172-
qv_hw_obj_type_t obj,
173-
int *nobjs
174-
);
175-
176166
/**
177167
*
178168
*/
@@ -188,17 +178,20 @@ qv_scope_group_rank(
188178
int
189179
qv_scope_group_size(
190180
qv_scope_t *scope,
191-
int *ntasks
181+
int *group_size
192182
);
193183

194184
/**
195185
*
196186
*/
197187
int
198-
qv_scope_barrier(
199-
qv_scope_t *scope
188+
qv_scope_nobjs(
189+
qv_scope_t *scope,
190+
qv_hw_obj_type_t obj,
191+
int *nobjs
200192
);
201193

194+
// TODO(skg) Rename to qv_scope_device_id_get?
202195
/**
203196
*
204197
*/
@@ -211,6 +204,14 @@ qv_scope_get_device_id(
211204
char **dev_id
212205
);
213206

207+
/**
208+
*
209+
*/
210+
int
211+
qv_scope_barrier(
212+
qv_scope_t *scope
213+
);
214+
214215
/**
215216
*
216217
*/

src/CMakeLists.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ add_library(
3434
qvi-subgroup.h
3535
qvi-group-pthread.h
3636
qvi-map.h
37-
qvi-split.h
37+
qvi-hwsplit.h
3838
qvi-scope.h
3939
qvi-log.cc
4040
qvi-utils.cc
@@ -49,7 +49,7 @@ add_library(
4949
qvi-pthread.cc
5050
qvi-group-pthread.cc
5151
qvi-map.cc
52-
qvi-split.cc
52+
qvi-hwsplit.cc
5353
qvi-scope.cc
5454
quo-vadis.cc
5555
quo-vadis-pthread.cc

src/quo-vadis-mpi.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ qvi_mpi_scope_get(
6464
const int rc = qvi_new(&izgroup, comm);
6565
if (qvi_unlikely(rc != QV_SUCCESS)) return rc;
6666

67-
return qv_scope_s::makei(izgroup, iscope, scope);
67+
return qv_scope_s::make_intrinsic(izgroup, iscope, scope);
6868
}
6969

7070
int

src/quo-vadis-omp.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ qvi_omp_scope_get(
3535
*scope = nullptr;
3636
return rc;
3737
}
38-
return qv_scope_s::makei(zgroup, iscope, scope);
38+
return qv_scope_s::make_intrinsic(zgroup, iscope, scope);
3939
}
4040

4141
int

src/quo-vadis-process.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ qvi_process_scope_get(
2828
*scope = nullptr;
2929
return rc;
3030
}
31-
return qv_scope_s::makei(zgroup, iscope, scope);
31+
return qv_scope_s::make_intrinsic(zgroup, iscope, scope);
3232
}
3333

3434
int

src/quo-vadis.cc

+3-4
Original file line numberDiff line numberDiff line change
@@ -119,17 +119,16 @@ qv_scope_group_rank(
119119
qvi_catch_and_return();
120120
}
121121

122-
// TODO(skg) Rename to qv_scope_group_size.
123122
int
124123
qv_scope_group_size(
125124
qv_scope_t *scope,
126-
int *ntasks
125+
int *group_size
127126
) {
128-
if (qvi_unlikely(!scope || !ntasks)) {
127+
if (qvi_unlikely(!scope || !group_size)) {
129128
return QV_ERR_INVLD_ARG;
130129
}
131130
try {
132-
*ntasks = scope->group_size();
131+
*group_size = scope->group_size();
133132
return QV_SUCCESS;
134133
}
135134
qvi_catch_and_return();

src/qvi-group-mpi.cc

+6-6
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@
2121
qvi_group_mpi_s::qvi_group_mpi_s(void)
2222
{
2323
const int rc = qvi_new(&m_task);
24-
if (rc != QV_SUCCESS) throw qvi_runtime_error();
24+
if (qvi_unlikely(rc != QV_SUCCESS)) throw qvi_runtime_error();
2525
}
2626

2727
qvi_group_mpi_s::qvi_group_mpi_s(
2828
qvi_mpi_t *mpi_ctx
2929
) : qvi_group_mpi_s()
3030
{
31-
if (!mpi_ctx) throw qvi_runtime_error();
31+
assert(mpi_ctx);
3232
m_mpi = mpi_ctx;
3333
}
3434

@@ -72,13 +72,13 @@ qvi_group_mpi_s::self(
7272
// Create and initialize the child with the parent's MPI context.
7373
qvi_group_mpi_t *ichild = nullptr;
7474
int rc = qvi_new(&ichild, m_mpi);
75-
if (rc != QV_SUCCESS) goto out;
75+
if (qvi_unlikely(rc != QV_SUCCESS)) goto out;
7676
// Create the underlying group using MPI_COMM_SELF.
7777
rc = qvi_mpi_group_create_from_mpi_comm(
7878
m_mpi, MPI_COMM_SELF, &ichild->m_mpi_group
7979
);
8080
out:
81-
if (rc != QV_SUCCESS) {
81+
if (qvi_unlikely(rc != QV_SUCCESS)) {
8282
qvi_delete(&ichild);
8383
}
8484
*child = ichild;
@@ -94,14 +94,14 @@ qvi_group_mpi_s::split(
9494
// Create and initialize the child with the parent's MPI context.
9595
qvi_group_mpi_t *ichild = nullptr;
9696
int rc = qvi_new(&ichild, m_mpi);
97-
if (rc != QV_SUCCESS) goto out;
97+
if (qvi_unlikely(rc != QV_SUCCESS)) goto out;
9898
// Split this group using MPI.
9999
rc = qvi_mpi_group_create_from_split(
100100
m_mpi, m_mpi_group, color,
101101
key, &ichild->m_mpi_group
102102
);
103103
out:
104-
if (rc != QV_SUCCESS) {
104+
if (qvi_unlikely(rc != QV_SUCCESS)) {
105105
qvi_delete(&ichild);
106106
}
107107
*child = ichild;

src/qvi-split.cc src/qvi-hwsplit.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88
*/
99

1010
/**
11-
* @file qvi-split.cc
11+
* @file qvi-hwsplit.cc
1212
*/
1313

14-
#include "qvi-split.h"
14+
#include "qvi-hwsplit.h"
1515
#include "qvi-bbuff.h"
1616
#include "qvi-rmi.h"
1717
#include "qvi-bbuff-rmi.h"

src/qvi-split.h src/qvi-hwsplit.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88
*/
99

1010
/**
11-
* @file qvi-split.h
11+
* @file qvi-hwsplit.h
1212
*/
1313

14-
#ifndef QVI_SPLIT_H
15-
#define QVI_SPLIT_H
14+
#ifndef QVI_HWSPLIT_H
15+
#define QVI_HWSPLIT_H
1616

1717
#include "qvi-common.h"
1818
#include "qvi-hwloc.h"

src/qvi-scope.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
#include "qvi-rmi.h"
2222
#include "qvi-task.h"
2323
#include "qvi-hwpool.h"
24-
#include "qvi-split.h"
24+
#include "qvi-hwsplit.h"
2525
#include "qvi-utils.h"
2626

2727
qv_scope_s::qv_scope_s(
@@ -67,7 +67,7 @@ scope_new(
6767
}
6868

6969
int
70-
qv_scope_s::makei(
70+
qv_scope_s::make_intrinsic(
7171
qvi_group_t *group,
7272
qv_scope_intrinsic_t iscope,
7373
qv_scope_t **scope

src/qvi-scope.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ struct qv_scope_s {
5050
);
5151
/** Takes the provided group and creates a new intrinsic scope from it. */
5252
static int
53-
makei(
53+
make_intrinsic(
5454
qvi_group_t *group,
5555
qv_scope_intrinsic_t iscope,
5656
qv_scope_t **scope

0 commit comments

Comments
 (0)