Skip to content
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
45 changes: 45 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,45 @@ jobs:
timeout --foreground -k 10s 4m make check
no_output_timeout: 60s

nvc:
parameters:
worker_type:
type: string
scheduler:
type: string
topology:
type: string
machine:
image: ubuntu-2204:2024.04.4
resource_class: << parameters.worker_type >>
environment:
CC: nvc
CXX: nvc++
steps:
- checkout
- run: |
curl https://developer.download.nvidia.com/hpc-sdk/ubuntu/DEB-GPG-KEY-NVIDIA-HPC-SDK | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-hpcsdk-archive-keyring.gpg
export MACHINE_TYPE=`uname -m`
if [ ${MACHINE_TYPE} == 'x86_64' ]; then echo 'deb [signed-by=/usr/share/keyrings/nvidia-hpcsdk-archive-keyring.gpg] https://developer.download.nvidia.com/hpc-sdk/ubuntu/amd64 /' | sudo tee /etc/apt/sources.list.d/nvhpc.list; fi
if [ ${MACHINE_TYPE} == 'aarch64' ]; then echo 'deb [signed-by=/usr/share/keyrings/nvidia-hpcsdk-archive-keyring.gpg] https://developer.download.nvidia.com/hpc-sdk/ubuntu/arm64 /' | sudo tee /etc/apt/sources.list.d/nvhpc.list; fi
sudo apt-get update -y
sudo apt-get install -y nvhpc-24-9
sudo apt-get install -y autoconf automake libtool
sudo apt-get install -y hwloc libhwloc-dev
- run: |
export MACHINE_TYPE=`uname -m`
if [ ${MACHINE_TYPE} == 'x86_64' ]; then export PATH="$PATH:/opt/nvidia/hpc_sdk/Linux_x86_64/24.9/compilers/bin"; fi
if [ ${MACHINE_TYPE} == 'aarch64' ]; then export PATH="$PATH:/opt/nvidia/hpc_sdk/Linux_aarch64/24.9/compilers/bin"; fi
nvc --version
./autogen.sh
./configure --enable-picky --disable-fastcontext --with-scheduler=<< parameters.scheduler >> -with-topology=<< parameters.topology >>
make -j2
make tests -j2
- run:
command: |
timeout --foreground -k 10s 4m make check
no_output_timeout: 60s

musl:
parameters:
worker_type:
Expand Down Expand Up @@ -185,6 +224,12 @@ workflows:
parameters:
scheduler: [nemesis, sherwood, distrib]
topology: ['no', binders, hwloc]
- nvc:
matrix:
parameters:
worker_type: [medium, arm.medium]
scheduler: [nemesis, sherwood, distrib]
topology: ['no', binders, hwloc]
- musl:
matrix:
parameters:
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ name: CI

on: [push, pull_request]

# Cancel the current workflow if a newer commit gets pushed to the
# branch or PR that triggered it.
concurrency:
group: ${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}

jobs:
linux-gcc:
runs-on: ubuntu-22.04
Expand Down
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ AC_CONFIG_MACRO_DIR([config])
AC_CONFIG_SRCDIR([src/qthread.c])

AM_INIT_AUTOMAKE([foreign subdir-objects dist-bzip2 no-define 1.16 ])
AM_SILENT_RULES([yes])
##AM_SILENT_RULES([yes])

# clean some extra things...
CLEANFILES="*~ .\#* .gdb_history"
Expand Down
2 changes: 1 addition & 1 deletion include/qt_alloc.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ void INTERNAL qt_internal_alignment_init(void);
#pragma warning(disable : 191)
#endif
extern size_t _pagesize;
#define pagesize ((const size_t)_pagesize)
#define pagesize ((size_t)_pagesize)
#endif // ifndef HAVE_QT_ALIGNED_ALLOC_H
/* vim:set expandtab: */
7 changes: 4 additions & 3 deletions include/qt_int_log.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@

static char const LogTable256[256] = {
#define LT(n) n, n, n, n, n, n, n, n, n, n, n, n, n, n, n, n
-1, 0, 1, 1, 2, 2, 2, 2, 3, 3, 3,
3, 3, 3, 3, 3, LT(4), LT(5), LT(5), LT(6), LT(6), LT(6),
LT(6), LT(7), LT(7), LT(7), LT(7), LT(7), LT(7), LT(7), LT(7)};
(char)-1, 0, 1, 1, 2, 2, 2, 2,
3, 3, 3, 3, 3, 3, 3, 3,
LT(4), LT(5), LT(5), LT(6), LT(6), LT(6), LT(6), LT(7),
LT(7), LT(7), LT(7), LT(7), LT(7), LT(7), LT(7)};

static inline uint32_t QT_INT_LOG(uint32_t v) {
uint32_t r;
Expand Down
7 changes: 4 additions & 3 deletions src/affinity/hwloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -233,21 +233,22 @@ void INTERNAL qt_affinity_init(qthread_shepherd_id_t *nbshepherds,
/* first, look for an exact match in width and find the proper depth */
unsigned int maxdepth = hwloc_topology_get_depth(topology);
unsigned int realdepth;
unsigned int fl_depth = -1; // first depth with #objs larger than nbsheps
unsigned int fl_depth =
(unsigned int)-1; // first depth with #objs larger than nbsheps
for (realdepth = 0; realdepth < maxdepth && shep_depth == -1;
++realdepth) {
unsigned int num = num_usable_by_depth(realdepth);
if (num == *nbshepherds) {
shep_depth = realdepth;
} else if ((num > *nbshepherds) && (fl_depth == -1)) {
} else if ((num > *nbshepherds) && (fl_depth == (unsigned int)-1)) {
fl_depth = realdepth;
}
}
/* second, if we failed, try an approximate match... */
/* should we use the last _smaller_, or the first _larger_ ? */
/* first option means overlapping but we can use all the cores */
/* second option means no overlapping, but cores will go unused */
if ((shep_depth == -1) && (fl_depth != -1)) {
if ((shep_depth == -1) && (fl_depth != (unsigned int)-1)) {
/* first larger then */
shep_depth = fl_depth;
}
Expand Down
4 changes: 2 additions & 2 deletions src/barrier/feb.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ void API_FUNC qt_barrier_enter(qt_barrier_t *b) {
qthread_readFF(NULL, &b->out_gate);
}
/* I'm on the way out, so decrement the blocker count */
waiters = qthread_incr(&b->blockers, -1) - 1;
waiters = qthread_incr(&b->blockers, (aligned_t)-1) - 1u;
if (waiters == 0) {
/* last guy out of the barrier, close the out_gate, open the in_gate */
qthread_empty(&b->out_gate);
Expand Down Expand Up @@ -119,7 +119,7 @@ void qt_global_barrier(void) {

void qt_global_barrier_init(size_t size, int debug) {
if (global_barrier == NULL) {
global_barrier = qt_barrier_create(size, 0);
global_barrier = qt_barrier_create(size, REGION_BARRIER);
assert(global_barrier);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/ds/dictionary/dictionary_shavit.c
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ static inline int qt_hash_remove(qt_hash h, qt_key_t const key) {
h->op_cleanup)) {
return 0;
}
qthread_incr(&h->count, -1);
qthread_incr(&h->count, (aligned_t)-1);
return 1;
}

Expand Down
12 changes: 6 additions & 6 deletions src/ds/qarray.c
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ void qarray_destroy(qarray *a) { /*{{{ */
qthread_incr(
&chunk_distribution_tracker[qarray_internal_segment_shep_read(
a, segmenthead)],
-1);
(aligned_t)-1);
}
break;
}
Expand All @@ -435,14 +435,14 @@ void qarray_destroy(qarray *a) { /*{{{ */
for (segment = 0; segment < segment_count; segment++) {
qthread_incr(&chunk_distribution_tracker[qarray_internal_shepof_segidx(
a, segment)],
-1);
(aligned_t)-1);
}
break;
}
case ALL_SAME:
qthread_incr(&chunk_distribution_tracker[a->dist_specific.dist_shep],
-1 * (a->count / a->segment_size +
((a->count % a->segment_size) ? 1 : 0)));
((aligned_t)-1) * (a->count / a->segment_size +
((a->count % a->segment_size) ? 1 : 0)));
break;
}
#ifdef QTHREAD_HAVE_MEM_AFFINITY
Expand Down Expand Up @@ -1202,7 +1202,7 @@ void qarray_set_shepof(qarray *a,
#endif /* ifdef QTHREAD_HAVE_MEM_AFFINITY */
qthread_incr(&chunk_distribution_tracker[shep], segment_count);
qthread_incr(&chunk_distribution_tracker[a->dist_specific.dist_shep],
-1 * segment_count);
((aligned_t)-1) * segment_count);
a->dist_specific.dist_shep = shep;
}
return;
Expand All @@ -1223,7 +1223,7 @@ void qarray_set_shepof(qarray *a,
}
#endif /* ifdef QTHREAD_HAVE_MEM_AFFINITY */
qthread_incr(&chunk_distribution_tracker[shep], 1);
qthread_incr(&chunk_distribution_tracker[cur_shep], -1);
qthread_incr(&chunk_distribution_tracker[cur_shep], (aligned_t)-1);
qarray_internal_segment_shep_write(a, seghead, shep);
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/qloop.c
Original file line number Diff line number Diff line change
Expand Up @@ -1017,7 +1017,7 @@ static aligned_t qqloop_wrapper(void *arg_void) { /*{{{*/
if (!qthread_shep_ok()) {
/* my shepherd has been disabled while I was running */
safeexit = 0;
qthread_incr(&(stat->activesheps), -1);
qthread_incr(&(stat->activesheps), (aligned_t)-1);
break;
}
} while (get_iters(iq, stat, &range));
Expand Down Expand Up @@ -1131,7 +1131,7 @@ void API_FUNC qt_loop_queue_addworker(
if (loop->stat.donecount == 0) {
qthread_fork_to((qthread_f)qqloop_wrapper, loop->qwa + shep, NULL, shep);
} else {
qthread_incr(&(loop->stat.activesheps), -1);
qthread_incr(&(loop->stat.activesheps), (aligned_t)-1);
}
} /*}}}*/

Expand Down
6 changes: 3 additions & 3 deletions src/qthread.c
Original file line number Diff line number Diff line change
Expand Up @@ -694,7 +694,7 @@ int API_FUNC qthread_initialize(void) { /*{{{ */

/* initialize the shepherds as having no affinity */
for (i = 0; i < nshepherds; i++) {
qlib->shepherds[i].node = -1;
qlib->shepherds[i].node = UINT32_MAX;
qlib->shepherds[i].shep_dists = NULL;
qlib->shepherds[i].sorted_sheplist = NULL;
qlib->shepherds[i].workers =
Expand Down Expand Up @@ -1287,14 +1287,14 @@ API_FUNC void *qthread_tos(void) {
API_FUNC void *qthread_bos(void) {
qthread_t const *f = qthread_internal_self();

return f->rdata->stack + qlib->qthread_stack_size;
return (void *)((char *)f->rdata->stack + qlib->qthread_stack_size);
}

size_t API_FUNC qthread_stackleft(void) { /*{{{ */
qthread_t const *f = qthread_internal_self();

if ((f != NULL) && (f->rdata->stack != NULL)) {
#ifdef __INTEL_COMPILER
#if defined(__INTEL_COMPILER)
size_t current = (size_t)&f;
#else
size_t current = (size_t)__builtin_frame_address(0);
Expand Down
4 changes: 2 additions & 2 deletions src/queue.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ int API_FUNC qthread_queue_release_one(qthread_queue_t q) {
break;
case NEMESIS_LENGTH:
t = qthread_queue_internal_NEMESIS_dequeue(&q->q.nemesis);
qthread_incr(&q->q.nemesis.length, -1);
qthread_incr(&q->q.nemesis.length, (aligned_t)-1);
break;
case CAPPED: t = qthread_queue_internal_capped_dequeue(&q->q.capped); break;
default: QTHREAD_TRAP();
Expand Down Expand Up @@ -284,7 +284,7 @@ void INTERNAL qthread_queue_internal_capped_enqueue(qthread_queue_capped_t *q,
offset = qthread_incr(&q->membercount, 1);
qassert_retvoid(offset >= q->maxmembers);
q->members[offset] = t;
qthread_incr(&q->busy, -1);
qthread_incr(&q->busy, (aligned_t)-1);
}

qthread_t INTERNAL *
Expand Down
2 changes: 1 addition & 1 deletion src/shepherds.c
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ qthread_disable_shepherd(qthread_shepherd_id_t const shep) { /*{{{ */
return QTHREAD_NOT_ALLOWED;
}
qthread_internal_incr(
&(qlib->nshepherds_active), &(qlib->nshepherds_active_lock), -1);
&(qlib->nshepherds_active), &(qlib->nshepherds_active_lock), (aligned_t)-1);
(void)QT_CAS(qlib->shepherds[shep].active, 1, 0);
return QTHREAD_SUCCESS;
} /*}}} */
Expand Down
2 changes: 1 addition & 1 deletion src/sincs/donecount.c
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ void API_FUNC qt_sinc_submit(qt_sinc_t *restrict sinc_,
}

// Update counter
qt_sinc_count_t count = qthread_incr(&sinc->counter, -1);
qt_sinc_count_t count = qthread_incr(&sinc->counter, (aligned_t)-1);
assert(count > 0);
if (1 == count) { // This is the final submit
qt_sinc_internal_collate(sinc_);
Expand Down
Loading
Loading