Enable -Wconversion and -Wsign-conversion
Prevents implicit conversions to go undetected, as they will have to be explicit now.
This commit is contained in:
parent
d98ca97624
commit
c8750b9dfd
@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- Enable -Wconversion and -Wsign-conversion.
|
||||||
|
|
||||||
## [1.10.0] - 2024-07-26
|
## [1.10.0] - 2024-07-26
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
@ -9,7 +9,7 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/")
|
|||||||
|
|
||||||
add_compile_options(-Wall -Wextra -Wformat
|
add_compile_options(-Wall -Wextra -Wformat
|
||||||
-Wmissing-prototypes -Wstrict-prototypes
|
-Wmissing-prototypes -Wstrict-prototypes
|
||||||
#-Wconversion -Wsign-conversion
|
-Wconversion -Wsign-conversion
|
||||||
-Wold-style-definition -pedantic
|
-Wold-style-definition -pedantic
|
||||||
-Werror
|
-Werror
|
||||||
)
|
)
|
||||||
|
@ -45,7 +45,7 @@ vaerr(const char *prefix, const char *func, const char *errstr, va_list ap)
|
|||||||
|
|
||||||
vfprintf(stderr, errstr, ap);
|
vfprintf(stderr, errstr, ap);
|
||||||
|
|
||||||
int len = strlen(errstr);
|
int len = (int) strlen(errstr);
|
||||||
|
|
||||||
if (len > 0) {
|
if (len > 0) {
|
||||||
char last = errstr[len - 1];
|
char last = errstr[len - 1];
|
||||||
@ -103,7 +103,7 @@ mkpath(const char *path, mode_t mode, int is_dir)
|
|||||||
char *copypath = strdup(path);
|
char *copypath = strdup(path);
|
||||||
|
|
||||||
/* Remove trailing slash */
|
/* Remove trailing slash */
|
||||||
int last = strlen(path) - 1;
|
int last = (int) strlen(path) - 1;
|
||||||
while (last > 0 && copypath[last] == '/')
|
while (last > 0 && copypath[last] == '/')
|
||||||
copypath[last--] = '\0';
|
copypath[last--] = '\0';
|
||||||
|
|
||||||
|
@ -106,7 +106,7 @@ bay_add_cb(struct bay *bay, enum bay_cb_type type,
|
|||||||
cb->func = func;
|
cb->func = func;
|
||||||
cb->arg = arg;
|
cb->arg = arg;
|
||||||
cb->bchan = bchan;
|
cb->bchan = bchan;
|
||||||
cb->type = type;
|
cb->type = (int) type;
|
||||||
cb->enabled = 0;
|
cb->enabled = 0;
|
||||||
|
|
||||||
if (enabled)
|
if (enabled)
|
||||||
|
@ -15,8 +15,8 @@ chan_init(struct chan *chan, enum chan_type type, const char *fmt, ...)
|
|||||||
va_list ap;
|
va_list ap;
|
||||||
va_start(ap, fmt);
|
va_start(ap, fmt);
|
||||||
|
|
||||||
int n = ARRAYLEN(chan->name);
|
int n = (int) ARRAYLEN(chan->name);
|
||||||
int ret = vsnprintf(chan->name, n, fmt, ap);
|
int ret = vsnprintf(chan->name, (size_t) n, fmt, ap);
|
||||||
if (ret >= n)
|
if (ret >= n)
|
||||||
die("channel name too long");
|
die("channel name too long");
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
|
@ -95,7 +95,7 @@ cindex(struct clkoff *table)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
table->index = calloc(table->nentries, sizeof(struct clkoff_entry *));
|
table->index = calloc((size_t) table->nentries, sizeof(struct clkoff_entry *));
|
||||||
|
|
||||||
if (table->index == NULL) {
|
if (table->index == NULL) {
|
||||||
err("calloc failed");
|
err("calloc failed");
|
||||||
|
@ -78,8 +78,8 @@ cpu_set_loom(struct cpu *cpu, struct loom *loom)
|
|||||||
static int
|
static int
|
||||||
set_name(struct cpu *cpu)
|
set_name(struct cpu *cpu)
|
||||||
{
|
{
|
||||||
size_t i = loom_get_gindex(cpu->loom);
|
size_t i = (size_t) loom_get_gindex(cpu->loom);
|
||||||
size_t j = cpu_get_phyid(cpu);
|
size_t j = (size_t) cpu_get_phyid(cpu);
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
if (cpu->is_virtual)
|
if (cpu->is_virtual)
|
||||||
@ -162,7 +162,7 @@ cpu_connect(struct cpu *cpu, struct bay *bay, struct recorder *rec)
|
|||||||
if (type < 0)
|
if (type < 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
long row = cpu->gindex;
|
long row = (long) cpu->gindex;
|
||||||
long flags = prv_flags[i];
|
long flags = prv_flags[i];
|
||||||
if (prv_register(prv, row, type, bay, c, flags)) {
|
if (prv_register(prv, row, type, bay, c, flags)) {
|
||||||
err("prv_register failed");
|
err("prv_register failed");
|
||||||
@ -176,7 +176,7 @@ cpu_connect(struct cpu *cpu, struct bay *bay, struct recorder *rec)
|
|||||||
struct pcf_value *
|
struct pcf_value *
|
||||||
cpu_add_to_pcf_type(struct cpu *cpu, struct pcf_type *type)
|
cpu_add_to_pcf_type(struct cpu *cpu, struct pcf_type *type)
|
||||||
{
|
{
|
||||||
return pcf_add_value(type, cpu->gindex + 1, cpu->name);
|
return pcf_add_value(type, (int) cpu->gindex + 1, cpu->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct thread *
|
static struct thread *
|
||||||
@ -215,8 +215,8 @@ cpu_update(struct cpu *cpu)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cpu->nth_running = running;
|
cpu->nth_running = (size_t) running;
|
||||||
cpu->nth_active = active;
|
cpu->nth_active = (size_t) active;
|
||||||
|
|
||||||
/* Only virtual cpus can be oversubscribed */
|
/* Only virtual cpus can be oversubscribed */
|
||||||
if (cpu->nth_running > 1 && !cpu->is_virtual) {
|
if (cpu->nth_running > 1 && !cpu->is_virtual) {
|
||||||
@ -265,7 +265,7 @@ cpu_update(struct cpu *cpu)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Update nth_running number in the channel */
|
/* Update nth_running number in the channel */
|
||||||
if (chan_set(&cpu->chan[CPU_CHAN_NRUN], value_int64(running)) != 0) {
|
if (chan_set(&cpu->chan[CPU_CHAN_NRUN], value_int64((int64_t) running)) != 0) {
|
||||||
err("chan_set nth_running failed");
|
err("chan_set nth_running failed");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (c) 2021-2023 Barcelona Supercomputing Center (BSC)
|
/* Copyright (c) 2021-2024 Barcelona Supercomputing Center (BSC)
|
||||||
* SPDX-License-Identifier: GPL-3.0-or-later */
|
* SPDX-License-Identifier: GPL-3.0-or-later */
|
||||||
|
|
||||||
#include "emu_ev.h"
|
#include "emu_ev.h"
|
||||||
@ -13,11 +13,11 @@ emu_ev(struct emu_ev *ev, const struct ovni_ev *oev,
|
|||||||
ev->v = oev->header.value;
|
ev->v = oev->header.value;
|
||||||
ev->mcv[3] = '\0';
|
ev->mcv[3] = '\0';
|
||||||
|
|
||||||
ev->rclock = oev->header.clock;
|
ev->rclock = (int64_t) oev->header.clock;
|
||||||
ev->sclock = sclock;
|
ev->sclock = sclock;
|
||||||
ev->dclock = dclock;
|
ev->dclock = dclock;
|
||||||
|
|
||||||
ev->payload_size = ovni_payload_size(oev);
|
ev->payload_size = (size_t) ovni_payload_size(oev);
|
||||||
|
|
||||||
if (ev->payload_size > 0) {
|
if (ev->payload_size > 0) {
|
||||||
ev->has_payload = 1;
|
ev->has_payload = 1;
|
||||||
|
@ -104,7 +104,7 @@ parse_arg(struct ev_spec *spec, char *arg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Copy name */
|
/* Copy name */
|
||||||
size_t n = snprintf(argspec->name, sizeof(argspec->name), "%s", name);
|
size_t n = (size_t) snprintf(argspec->name, sizeof(argspec->name), "%s", name);
|
||||||
if (n >= sizeof(argspec->name)) {
|
if (n >= sizeof(argspec->name)) {
|
||||||
err("argument name too long: %s", name);
|
err("argument name too long: %s", name);
|
||||||
return -1;
|
return -1;
|
||||||
@ -364,7 +364,7 @@ print_arg(struct ev_arg *arg, const char *fmt, struct cursor *c, struct emu_ev *
|
|||||||
#define CASE(TYPE) \
|
#define CASE(TYPE) \
|
||||||
do { \
|
do { \
|
||||||
TYPE *data = (TYPE *) &payload[arg->offset]; \
|
TYPE *data = (TYPE *) &payload[arg->offset]; \
|
||||||
n = snprintf(c->out, c->len, fmt, *data); \
|
n = snprintf(c->out, (size_t) c->len, fmt, *data); \
|
||||||
if (n >= c->len) { \
|
if (n >= c->len) { \
|
||||||
err("no space for argument"); \
|
err("no space for argument"); \
|
||||||
return -1; \
|
return -1; \
|
||||||
@ -386,8 +386,8 @@ print_arg(struct ev_arg *arg, const char *fmt, struct cursor *c, struct emu_ev *
|
|||||||
char *data = (char *) &payload[arg->offset];
|
char *data = (char *) &payload[arg->offset];
|
||||||
/* Here we trust the input string to
|
/* Here we trust the input string to
|
||||||
* contain a nil at the end */
|
* contain a nil at the end */
|
||||||
int n = snprintf(c->out, c->len, fmt, data);
|
int n = snprintf(c->out, (size_t) c->len, fmt, data);
|
||||||
if (n >= c->len) {
|
if (n >= (int) c->len) {
|
||||||
err("no space for string argument");
|
err("no space for string argument");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,7 @@ get_model_cpu(struct cpu *cpu, int id)
|
|||||||
static int
|
static int
|
||||||
init_chan(struct model_cpu *cpu, const struct model_chan_spec *spec, int64_t gindex)
|
init_chan(struct model_cpu *cpu, const struct model_chan_spec *spec, int64_t gindex)
|
||||||
{
|
{
|
||||||
cpu->track = calloc(spec->nch, sizeof(struct track));
|
cpu->track = calloc((size_t) spec->nch, sizeof(struct track));
|
||||||
if (cpu->track == NULL) {
|
if (cpu->track == NULL) {
|
||||||
err("calloc failed:");
|
err("calloc failed:");
|
||||||
return -1;
|
return -1;
|
||||||
@ -108,7 +108,7 @@ connect_cpu(struct emu *emu, struct cpu *scpu, int id)
|
|||||||
|
|
||||||
struct chan *sel = cpu_get_th_chan(scpu);
|
struct chan *sel = cpu_get_th_chan(scpu);
|
||||||
|
|
||||||
int64_t nthreads = emu->system.nthreads;
|
int64_t nthreads = (int64_t) emu->system.nthreads;
|
||||||
if (track_set_select(track, sel, NULL, nthreads) != 0) {
|
if (track_set_select(track, sel, NULL, nthreads) != 0) {
|
||||||
err("track_select failed");
|
err("track_select failed");
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -21,7 +21,7 @@ model_evspec_init(struct model_evspec *evspec, struct model_spec *spec)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Preallocate a contiguous map, as we know the size */
|
/* Preallocate a contiguous map, as we know the size */
|
||||||
evspec->alloc = calloc(evspec->nevents, sizeof(struct ev_spec));
|
evspec->alloc = calloc((size_t) evspec->nevents, sizeof(struct ev_spec));
|
||||||
if (evspec->alloc == NULL) {
|
if (evspec->alloc == NULL) {
|
||||||
err("calloc failed:");
|
err("calloc failed:");
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -35,7 +35,7 @@ create_values(const struct model_pvt_spec *pvt,
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
for (const struct pcf_value_label *p = q; p->label != NULL; p++) {
|
for (const struct pcf_value_label *p = q; p->label != NULL; p++) {
|
||||||
if (pcf_add_value(t, p->value, p->label) == NULL) {
|
if (pcf_add_value(t, (int) p->value, p->label) == NULL) {
|
||||||
err("pcf_add_value failed");
|
err("pcf_add_value failed");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -66,7 +66,7 @@ create_type(const struct model_pvt_spec *pvt,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct pcf_type *pcftype = pcf_add_type(pcf, type, label);
|
struct pcf_type *pcftype = pcf_add_type(pcf, (int) type, label);
|
||||||
if (pcftype == NULL) {
|
if (pcftype == NULL) {
|
||||||
err("pcf_add_type failed");
|
err("pcf_add_type failed");
|
||||||
return -1;
|
return -1;
|
||||||
@ -106,7 +106,7 @@ connect_cpu_prv(struct emu *emu, struct cpu *scpu, struct prv *prv, int id)
|
|||||||
for (int i = 0; i < spec->nch; i++) {
|
for (int i = 0; i < spec->nch; i++) {
|
||||||
struct chan *out = track_get_output(&cpu->track[i]);
|
struct chan *out = track_get_output(&cpu->track[i]);
|
||||||
long type = spec->pvt->type[i];
|
long type = spec->pvt->type[i];
|
||||||
long row = scpu->gindex;
|
long row = (long) scpu->gindex;
|
||||||
long flags = flags_arr ? flags_arr[i] : 0;
|
long flags = flags_arr ? flags_arr[i] : 0;
|
||||||
if (prv_register(prv, row, type, &emu->bay, out, flags)) {
|
if (prv_register(prv, row, type, &emu->bay, out, flags)) {
|
||||||
err("prv_register failed");
|
err("prv_register failed");
|
||||||
@ -158,7 +158,7 @@ connect_thread_prv(struct emu *emu, struct thread *sth, struct prv *prv, int id)
|
|||||||
for (int i = 0; i < spec->nch; i++) {
|
for (int i = 0; i < spec->nch; i++) {
|
||||||
struct chan *out = track_get_output(&th->track[i]);
|
struct chan *out = track_get_output(&th->track[i]);
|
||||||
long type = spec->pvt->type[i];
|
long type = spec->pvt->type[i];
|
||||||
long row = sth->gindex;
|
long row = (long) sth->gindex;
|
||||||
long flags = flags_arr ? flags_arr[i] : 0;
|
long flags = flags_arr ? flags_arr[i] : 0;
|
||||||
if (prv_register(prv, row, type, &emu->bay, out, flags)) {
|
if (prv_register(prv, row, type, &emu->bay, out, flags)) {
|
||||||
err("prv_register failed");
|
err("prv_register failed");
|
||||||
|
@ -22,7 +22,7 @@ init_chan(struct model_thread *th, const struct model_chan_spec *spec, int64_t g
|
|||||||
const char *fmt = "%s.thread%"PRIi64".%s";
|
const char *fmt = "%s.thread%"PRIi64".%s";
|
||||||
const char *prefix = spec->prefix;
|
const char *prefix = spec->prefix;
|
||||||
|
|
||||||
th->ch = calloc(spec->nch, sizeof(struct chan));
|
th->ch = calloc((size_t) spec->nch, sizeof(struct chan));
|
||||||
if (th->ch == NULL) {
|
if (th->ch == NULL) {
|
||||||
err("calloc failed:");
|
err("calloc failed:");
|
||||||
return -1;
|
return -1;
|
||||||
@ -30,7 +30,7 @@ init_chan(struct model_thread *th, const struct model_chan_spec *spec, int64_t g
|
|||||||
|
|
||||||
for (int i = 0; i < spec->nch; i++) {
|
for (int i = 0; i < spec->nch; i++) {
|
||||||
struct chan *c = &th->ch[i];
|
struct chan *c = &th->ch[i];
|
||||||
int type = spec->ch_stack[i];
|
enum chan_type type = spec->ch_stack[i] ? CHAN_STACK : CHAN_SINGLE;
|
||||||
const char *ch_name = spec->ch_names[i];
|
const char *ch_name = spec->ch_names[i];
|
||||||
chan_init(c, type, fmt, prefix, gindex, ch_name);
|
chan_init(c, type, fmt, prefix, gindex, ch_name);
|
||||||
|
|
||||||
@ -45,7 +45,7 @@ init_chan(struct model_thread *th, const struct model_chan_spec *spec, int64_t g
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
th->track = calloc(spec->nch, sizeof(struct track));
|
th->track = calloc((size_t) spec->nch, sizeof(struct track));
|
||||||
if (th->track == NULL) {
|
if (th->track == NULL) {
|
||||||
err("calloc failed:");
|
err("calloc failed:");
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -177,7 +177,7 @@ mux_init(struct mux *mux,
|
|||||||
mux->select = select;
|
mux->select = select;
|
||||||
mux->output = output;
|
mux->output = output;
|
||||||
mux->ninputs = ninputs;
|
mux->ninputs = ninputs;
|
||||||
mux->inputs = calloc(ninputs, sizeof(struct mux_input));
|
mux->inputs = calloc((size_t) ninputs, sizeof(struct mux_input));
|
||||||
mux->def = value_null();
|
mux->def = value_null();
|
||||||
|
|
||||||
if (mux->inputs == NULL) {
|
if (mux->inputs == NULL) {
|
||||||
|
@ -59,12 +59,12 @@ model_nanos6_breakdown_create(struct emu *emu)
|
|||||||
|
|
||||||
/* Count phy cpus */
|
/* Count phy cpus */
|
||||||
struct system *sys = &emu->system;
|
struct system *sys = &emu->system;
|
||||||
int64_t nphycpus = sys->ncpus - sys->nlooms;
|
int64_t nphycpus = (int64_t) (sys->ncpus - sys->nlooms);
|
||||||
bemu->nphycpus = nphycpus;
|
bemu->nphycpus = nphycpus;
|
||||||
|
|
||||||
/* Create a new Paraver trace */
|
/* Create a new Paraver trace */
|
||||||
struct recorder *rec = &emu->recorder;
|
struct recorder *rec = &emu->recorder;
|
||||||
bemu->pvt = recorder_add_pvt(rec, "nanos6-breakdown", nphycpus);
|
bemu->pvt = recorder_add_pvt(rec, "nanos6-breakdown", (long) nphycpus);
|
||||||
if (bemu->pvt == NULL) {
|
if (bemu->pvt == NULL) {
|
||||||
err("recorder_add_pvt failed");
|
err("recorder_add_pvt failed");
|
||||||
return -1;
|
return -1;
|
||||||
@ -245,7 +245,7 @@ model_nanos6_breakdown_connect(struct emu *emu)
|
|||||||
flags |= PRV_ZERO;
|
flags |= PRV_ZERO;
|
||||||
|
|
||||||
struct chan *out = sort_get_output(&bemu->sort, i);
|
struct chan *out = sort_get_output(&bemu->sort, i);
|
||||||
if (prv_register(prv, i, type, bay, out, flags)) {
|
if (prv_register(prv, (long) i, type, bay, out, flags)) {
|
||||||
err("prv_register failed");
|
err("prv_register failed");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -268,7 +268,7 @@ model_nanos6_breakdown_finish(struct emu *emu,
|
|||||||
struct pcf *pcf = pvt_get_pcf(bemu->pvt);
|
struct pcf *pcf = pvt_get_pcf(bemu->pvt);
|
||||||
long typeid = PRV_NANOS6_BREAKDOWN;
|
long typeid = PRV_NANOS6_BREAKDOWN;
|
||||||
char label[] = "CPU: Nanos6 Runtime/Idle/Task breakdown";
|
char label[] = "CPU: Nanos6 Runtime/Idle/Task breakdown";
|
||||||
struct pcf_type *pcftype = pcf_add_type(pcf, typeid, label);
|
struct pcf_type *pcftype = pcf_add_type(pcf, (int) typeid, label);
|
||||||
const struct pcf_value_label *v = NULL;
|
const struct pcf_value_label *v = NULL;
|
||||||
|
|
||||||
/* Emit subsystem values */
|
/* Emit subsystem values */
|
||||||
@ -307,7 +307,7 @@ model_nanos6_breakdown_finish(struct emu *emu,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (prf_add(prf, row, name) != 0) {
|
if (prf_add(prf, (long) row, name) != 0) {
|
||||||
err("prf_add failed for %s", name);
|
err("prf_add failed for %s", name);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -299,7 +299,7 @@ update_task_state(struct emu *emu)
|
|||||||
static int
|
static int
|
||||||
expand_transition_value(struct emu *emu, int was_running, int runs_now, char *tr_p)
|
expand_transition_value(struct emu *emu, int was_running, int runs_now, char *tr_p)
|
||||||
{
|
{
|
||||||
char tr = emu->ev->v;
|
char tr = (char) emu->ev->v;
|
||||||
|
|
||||||
/* Ensure we don't clobber the value */
|
/* Ensure we don't clobber the value */
|
||||||
if (tr == 'X' || tr == 'E') {
|
if (tr == 'X' || tr == 'E') {
|
||||||
@ -419,7 +419,7 @@ update_task(struct emu *emu)
|
|||||||
struct task *next = bnext == NULL ? NULL : body_get_task(bnext);
|
struct task *next = bnext == NULL ? NULL : body_get_task(bnext);
|
||||||
|
|
||||||
/* Update the subsystem channel */
|
/* Update the subsystem channel */
|
||||||
if (update_task_ss_channel(emu, emu->ev->v) != 0) {
|
if (update_task_ss_channel(emu, (char) emu->ev->v) != 0) {
|
||||||
err("update_task_ss_channel failed");
|
err("update_task_ss_channel failed");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -467,7 +467,7 @@ create_task(struct emu *emu)
|
|||||||
* task, so we relax the model to allow this for now. */
|
* task, so we relax the model to allow this for now. */
|
||||||
flags |= TASK_FLAG_RELAX_NESTING;
|
flags |= TASK_FLAG_RELAX_NESTING;
|
||||||
|
|
||||||
if (task_create(info, type_id, task_id, flags) != 0) {
|
if (task_create(info, type_id, task_id, (uint32_t) flags) != 0) {
|
||||||
err("task_create failed");
|
err("task_create failed");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -402,7 +402,7 @@ finish_pvt(struct emu *emu, const char *name)
|
|||||||
}
|
}
|
||||||
struct pcf *pcf = pvt_get_pcf(pvt);
|
struct pcf *pcf = pvt_get_pcf(pvt);
|
||||||
long typeid = pvt_type[CH_TYPE];
|
long typeid = pvt_type[CH_TYPE];
|
||||||
struct pcf_type *pcftype = pcf_find_type(pcf, typeid);
|
struct pcf_type *pcftype = pcf_find_type(pcf, (int) typeid);
|
||||||
|
|
||||||
for (struct proc *p = sys->procs; p; p = p->gnext) {
|
for (struct proc *p = sys->procs; p; p = p->gnext) {
|
||||||
struct nanos6_proc *proc = EXT(p, model_id);
|
struct nanos6_proc *proc = EXT(p, model_id);
|
||||||
|
@ -82,12 +82,12 @@ model_nosv_breakdown_create(struct emu *emu)
|
|||||||
|
|
||||||
/* Count phy cpus */
|
/* Count phy cpus */
|
||||||
struct system *sys = &emu->system;
|
struct system *sys = &emu->system;
|
||||||
int64_t nphycpus = sys->ncpus - sys->nlooms;
|
int64_t nphycpus = (int64_t) (sys->ncpus - sys->nlooms);
|
||||||
bemu->nphycpus = nphycpus;
|
bemu->nphycpus = nphycpus;
|
||||||
|
|
||||||
/* Create a new Paraver trace */
|
/* Create a new Paraver trace */
|
||||||
struct recorder *rec = &emu->recorder;
|
struct recorder *rec = &emu->recorder;
|
||||||
bemu->pvt = recorder_add_pvt(rec, "nosv-breakdown", nphycpus);
|
bemu->pvt = recorder_add_pvt(rec, "nosv-breakdown", (long) nphycpus);
|
||||||
if (bemu->pvt == NULL) {
|
if (bemu->pvt == NULL) {
|
||||||
err("recorder_add_pvt failed");
|
err("recorder_add_pvt failed");
|
||||||
return -1;
|
return -1;
|
||||||
@ -270,7 +270,7 @@ model_nosv_breakdown_connect(struct emu *emu)
|
|||||||
long flags = PRV_SKIPDUP | PRV_ZERO;
|
long flags = PRV_SKIPDUP | PRV_ZERO;
|
||||||
|
|
||||||
struct chan *out = sort_get_output(&bemu->sort, i);
|
struct chan *out = sort_get_output(&bemu->sort, i);
|
||||||
if (prv_register(prv, i, type, bay, out, flags)) {
|
if (prv_register(prv, (long) i, type, bay, out, flags)) {
|
||||||
err("prv_register failed");
|
err("prv_register failed");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -293,7 +293,7 @@ model_nosv_breakdown_finish(struct emu *emu,
|
|||||||
struct pcf *pcf = pvt_get_pcf(bemu->pvt);
|
struct pcf *pcf = pvt_get_pcf(bemu->pvt);
|
||||||
long typeid = PRV_NOSV_BREAKDOWN;
|
long typeid = PRV_NOSV_BREAKDOWN;
|
||||||
char label[] = "CPU: nOS-V Runtime/Idle/Task breakdown";
|
char label[] = "CPU: nOS-V Runtime/Idle/Task breakdown";
|
||||||
struct pcf_type *pcftype = pcf_add_type(pcf, typeid, label);
|
struct pcf_type *pcftype = pcf_add_type(pcf, (int) typeid, label);
|
||||||
const struct pcf_value_label *v = NULL;
|
const struct pcf_value_label *v = NULL;
|
||||||
|
|
||||||
/* Emit subsystem values */
|
/* Emit subsystem values */
|
||||||
@ -332,7 +332,7 @@ model_nosv_breakdown_finish(struct emu *emu,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (prf_add(prf, row, name) != 0) {
|
if (prf_add(prf, (long) row, name) != 0) {
|
||||||
err("prf_add failed for %s", name);
|
err("prf_add failed for %s", name);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -324,7 +324,7 @@ update_task_state(struct emu *emu)
|
|||||||
static int
|
static int
|
||||||
expand_transition_value(struct emu *emu, int was_running, int runs_now, char *tr_p)
|
expand_transition_value(struct emu *emu, int was_running, int runs_now, char *tr_p)
|
||||||
{
|
{
|
||||||
char tr = emu->ev->v;
|
char tr = (char) emu->ev->v;
|
||||||
|
|
||||||
/* Ensure we don't clobber the value */
|
/* Ensure we don't clobber the value */
|
||||||
if (tr == 'X' || tr == 'E') {
|
if (tr == 'X' || tr == 'E') {
|
||||||
@ -441,7 +441,7 @@ update_task(struct emu *emu)
|
|||||||
struct body *next = task_get_running(stack);
|
struct body *next = task_get_running(stack);
|
||||||
|
|
||||||
/* Update the subsystem channel */
|
/* Update the subsystem channel */
|
||||||
if (update_task_ss_channel(emu, emu->ev->v) != 0) {
|
if (update_task_ss_channel(emu, (char) emu->ev->v) != 0) {
|
||||||
err("update_task_ss_channel failed");
|
err("update_task_ss_channel failed");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -509,7 +509,7 @@ pre_task(struct emu *emu)
|
|||||||
switch (emu->ev->v) {
|
switch (emu->ev->v) {
|
||||||
case 'C':
|
case 'C':
|
||||||
case 'c':
|
case 'c':
|
||||||
ret = create_task(emu, emu->ev->v);
|
ret = create_task(emu, (char) emu->ev->v);
|
||||||
break;
|
break;
|
||||||
case 'x':
|
case 'x':
|
||||||
case 'e':
|
case 'e':
|
||||||
|
@ -390,18 +390,18 @@ pre_burst(struct emu *emu)
|
|||||||
for (int i = 0; i < n; i++)
|
for (int i = 0; i < n; i++)
|
||||||
deltas[i] = th->burst_time[i + 1] - th->burst_time[i];
|
deltas[i] = th->burst_time[i + 1] - th->burst_time[i];
|
||||||
|
|
||||||
qsort(deltas, n, sizeof(int64_t), compare_int64);
|
qsort(deltas, (size_t) n, sizeof(int64_t), compare_int64);
|
||||||
|
|
||||||
double avg = 0.0;
|
double avg = 0.0;
|
||||||
double maxdelta = 0;
|
double maxdelta = 0;
|
||||||
for (int i = 0; i < n; i++) {
|
for (int i = 0; i < n; i++) {
|
||||||
if (deltas[i] > maxdelta)
|
if ((double) deltas[i] > maxdelta)
|
||||||
maxdelta = deltas[i];
|
maxdelta = (double) deltas[i];
|
||||||
avg += deltas[i];
|
avg += (double) deltas[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
avg /= (double) n;
|
avg /= (double) n;
|
||||||
double median = deltas[n / 2];
|
double median = (double) deltas[n / 2];
|
||||||
|
|
||||||
info("%s burst stats: median/avg/max = %3.0f/%3.0f/%3.0f ns",
|
info("%s burst stats: median/avg/max = %3.0f/%3.0f/%3.0f ns",
|
||||||
emu->loom->id, median, avg, maxdelta);
|
emu->loom->id, median, avg, maxdelta);
|
||||||
|
@ -303,7 +303,7 @@ create_thread_chan(struct ovni_mark_emu *m, struct bay *bay, struct thread *th)
|
|||||||
struct ovni_mark_thread *t = &oth->mark;
|
struct ovni_mark_thread *t = &oth->mark;
|
||||||
|
|
||||||
/* Create as many channels as required */
|
/* Create as many channels as required */
|
||||||
t->channels = calloc(m->ntypes, sizeof(struct chan));
|
t->channels = calloc((size_t) m->ntypes, sizeof(struct chan));
|
||||||
if (t->channels == NULL) {
|
if (t->channels == NULL) {
|
||||||
err("calloc failed:");
|
err("calloc failed:");
|
||||||
return -1;
|
return -1;
|
||||||
@ -330,7 +330,7 @@ create_thread_chan(struct ovni_mark_emu *m, struct bay *bay, struct thread *th)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Setup tracking */
|
/* Setup tracking */
|
||||||
t->track = calloc(m->ntypes, sizeof(struct track));
|
t->track = calloc((size_t) m->ntypes, sizeof(struct track));
|
||||||
if (t->track == NULL) {
|
if (t->track == NULL) {
|
||||||
err("calloc failed:");
|
err("calloc failed:");
|
||||||
return -1;
|
return -1;
|
||||||
@ -358,7 +358,7 @@ init_cpu(struct ovni_mark_emu *m, struct bay *bay, struct cpu *cpu)
|
|||||||
struct ovni_mark_cpu *c = &ocpu->mark;
|
struct ovni_mark_cpu *c = &ocpu->mark;
|
||||||
|
|
||||||
/* Setup tracking */
|
/* Setup tracking */
|
||||||
c->track = calloc(m->ntypes, sizeof(struct track));
|
c->track = calloc((size_t) m->ntypes, sizeof(struct track));
|
||||||
if (c->track == NULL) {
|
if (c->track == NULL) {
|
||||||
err("calloc failed:");
|
err("calloc failed:");
|
||||||
return -1;
|
return -1;
|
||||||
@ -442,7 +442,7 @@ connect_thread_prv(struct emu *emu, struct thread *sth, struct prv *prv)
|
|||||||
/* Then connect the output of the tracking module to the prv
|
/* Then connect the output of the tracking module to the prv
|
||||||
* trace for the current thread */
|
* trace for the current thread */
|
||||||
struct chan *out = track_get_output(track);
|
struct chan *out = track_get_output(track);
|
||||||
long row = sth->gindex;
|
long row = (long) sth->gindex;
|
||||||
long flags = PRV_SKIPDUPNULL;
|
long flags = PRV_SKIPDUPNULL;
|
||||||
long prvtype = type->prvtype;
|
long prvtype = type->prvtype;
|
||||||
if (prv_register(prv, row, prvtype, &emu->bay, out, flags)) {
|
if (prv_register(prv, row, prvtype, &emu->bay, out, flags)) {
|
||||||
@ -457,14 +457,14 @@ connect_thread_prv(struct emu *emu, struct thread *sth, struct prv *prv)
|
|||||||
static int
|
static int
|
||||||
create_type(struct pcf *pcf, struct mark_type *type)
|
create_type(struct pcf *pcf, struct mark_type *type)
|
||||||
{
|
{
|
||||||
struct pcf_type *pcftype = pcf_add_type(pcf, type->prvtype, type->title);
|
struct pcf_type *pcftype = pcf_add_type(pcf, (int) type->prvtype, type->title);
|
||||||
if (pcftype == NULL) {
|
if (pcftype == NULL) {
|
||||||
err("pcf_add_type failed");
|
err("pcf_add_type failed");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (struct mark_label *l = type->labels; l; l = l->hh.next) {
|
for (struct mark_label *l = type->labels; l; l = l->hh.next) {
|
||||||
if (pcf_add_value(pcftype, l->value, l->label) == NULL) {
|
if (pcf_add_value(pcftype, (int) l->value, l->label) == NULL) {
|
||||||
err("pcf_add_value failed");
|
err("pcf_add_value failed");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -534,7 +534,7 @@ connect_cpu_prv(struct emu *emu, struct cpu *scpu, struct prv *prv)
|
|||||||
struct track *track = &mcpu->track[i];
|
struct track *track = &mcpu->track[i];
|
||||||
struct chan *sel = cpu_get_th_chan(scpu);
|
struct chan *sel = cpu_get_th_chan(scpu);
|
||||||
|
|
||||||
int64_t nthreads = emu->system.nthreads;
|
int64_t nthreads = (int64_t) emu->system.nthreads;
|
||||||
if (track_set_select(track, sel, NULL, nthreads) != 0) {
|
if (track_set_select(track, sel, NULL, nthreads) != 0) {
|
||||||
err("track_select failed");
|
err("track_select failed");
|
||||||
return -1;
|
return -1;
|
||||||
@ -557,7 +557,7 @@ connect_cpu_prv(struct emu *emu, struct cpu *scpu, struct prv *prv)
|
|||||||
/* Then connect the output of the tracking module to the prv
|
/* Then connect the output of the tracking module to the prv
|
||||||
* trace for the current thread */
|
* trace for the current thread */
|
||||||
struct chan *out = track_get_output(track);
|
struct chan *out = track_get_output(track);
|
||||||
long row = scpu->gindex;
|
long row = (long) scpu->gindex;
|
||||||
long flags = PRV_SKIPDUPNULL;
|
long flags = PRV_SKIPDUPNULL;
|
||||||
long prvtype = type->prvtype;
|
long prvtype = type->prvtype;
|
||||||
if (prv_register(prv, row, prvtype, &emu->bay, out, flags)) {
|
if (prv_register(prv, row, prvtype, &emu->bay, out, flags)) {
|
||||||
|
@ -20,7 +20,7 @@ static int
|
|||||||
html_encode(char *dst, int ndst, const char *src)
|
html_encode(char *dst, int ndst, const char *src)
|
||||||
{
|
{
|
||||||
int j = 0;
|
int j = 0;
|
||||||
int nsrc = strlen(src);
|
int nsrc = (int) strlen(src);
|
||||||
|
|
||||||
for (int i = 0; i < nsrc; i++) {
|
for (int i = 0; i < nsrc; i++) {
|
||||||
/* Simple check */
|
/* Simple check */
|
||||||
@ -36,7 +36,7 @@ html_encode(char *dst, int ndst, const char *src)
|
|||||||
case '\'': strcpy(&dst[j], "'"); j += 6; break;
|
case '\'': strcpy(&dst[j], "'"); j += 6; break;
|
||||||
case '<': strcpy(&dst[j], "<"); j += 4; break;
|
case '<': strcpy(&dst[j], "<"); j += 4; break;
|
||||||
case '>': strcpy(&dst[j], ">"); j += 4; break;
|
case '>': strcpy(&dst[j], ">"); j += 4; break;
|
||||||
default: dst[j++] = c; break;
|
default: dst[j++] = (char) c; break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -179,7 +179,7 @@ write_events(struct ovni_ev **table, long n, uint8_t *buf)
|
|||||||
{
|
{
|
||||||
for (long i = 0; i < n; i++) {
|
for (long i = 0; i < n; i++) {
|
||||||
struct ovni_ev *ev = table[i];
|
struct ovni_ev *ev = table[i];
|
||||||
size_t size = ovni_ev_size(ev);
|
size_t size = (size_t) ovni_ev_size(ev);
|
||||||
memcpy(buf, ev, size);
|
memcpy(buf, ev, size);
|
||||||
buf += size;
|
buf += size;
|
||||||
|
|
||||||
@ -200,8 +200,8 @@ cmp_ev(const void *a, const void *b)
|
|||||||
struct ovni_ev *ev1 = *pev1;
|
struct ovni_ev *ev1 = *pev1;
|
||||||
struct ovni_ev *ev2 = *pev2;
|
struct ovni_ev *ev2 = *pev2;
|
||||||
|
|
||||||
int64_t clock1 = ev1->header.clock;
|
int64_t clock1 = (int64_t) ev1->header.clock;
|
||||||
int64_t clock2 = ev2->header.clock;
|
int64_t clock2 = (int64_t) ev2->header.clock;
|
||||||
|
|
||||||
if (clock1 < clock2)
|
if (clock1 < clock2)
|
||||||
return -1;
|
return -1;
|
||||||
@ -223,19 +223,19 @@ sort_buf(uint8_t *src, uint8_t *buf, int64_t bufsize)
|
|||||||
ev->header.clock);
|
ev->header.clock);
|
||||||
|
|
||||||
/* Create a copy of the array */
|
/* Create a copy of the array */
|
||||||
uint8_t *buf2 = malloc(bufsize);
|
uint8_t *buf2 = malloc((size_t) bufsize);
|
||||||
if (buf2 == NULL)
|
if (buf2 == NULL)
|
||||||
die("malloc failed:");
|
die("malloc failed:");
|
||||||
|
|
||||||
memcpy(buf2, src, bufsize);
|
memcpy(buf2, src, (size_t) bufsize);
|
||||||
|
|
||||||
long n = count_events(buf2, buf2 + bufsize);
|
long n = count_events(buf2, buf2 + bufsize);
|
||||||
struct ovni_ev **table = calloc(n, sizeof(struct ovni_ev *));
|
struct ovni_ev **table = calloc((size_t) n, sizeof(struct ovni_ev *));
|
||||||
if (table == NULL)
|
if (table == NULL)
|
||||||
die("calloc failed:");
|
die("calloc failed:");
|
||||||
|
|
||||||
index_events(table, n, buf2);
|
index_events(table, n, buf2);
|
||||||
qsort(table, n, sizeof(struct ovni_ev *), cmp_ev);
|
qsort(table, (size_t) n, sizeof(struct ovni_ev *), cmp_ev);
|
||||||
write_events(table, n, buf);
|
write_events(table, n, buf);
|
||||||
|
|
||||||
dbg("first event after sorting %c%c%c at %"PRIu64,
|
dbg("first event after sorting %c%c%c at %"PRIu64,
|
||||||
@ -260,7 +260,7 @@ write_stream(int fd, void *base, void *dst, const void *src, size_t size)
|
|||||||
if (written < 0)
|
if (written < 0)
|
||||||
die("pwrite failed:");
|
die("pwrite failed:");
|
||||||
|
|
||||||
size -= written;
|
size -= (size_t) written;
|
||||||
src = (void *) (((uint8_t *) src) + written);
|
src = (void *) (((uint8_t *) src) + written);
|
||||||
dst = (void *) (((uint8_t *) dst) + written);
|
dst = (void *) (((uint8_t *) dst) + written);
|
||||||
}
|
}
|
||||||
@ -300,7 +300,7 @@ execute_sort_plan(struct sortplan *sp)
|
|||||||
if (!buf)
|
if (!buf)
|
||||||
die("malloc failed:");
|
die("malloc failed:");
|
||||||
|
|
||||||
sort_buf((uint8_t *) first, buf, bufsize);
|
sort_buf((uint8_t *) first, buf, (int64_t) bufsize);
|
||||||
|
|
||||||
write_stream(sp->fd, sp->base, first, buf, bufsize);
|
write_stream(sp->fd, sp->base, first, buf, bufsize);
|
||||||
|
|
||||||
@ -435,8 +435,8 @@ process_trace(struct trace *trace)
|
|||||||
struct ring ring;
|
struct ring ring;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
ring.size = max_look_back;
|
ring.size = (ssize_t) max_look_back;
|
||||||
ring.ev = malloc(ring.size * sizeof(struct ovni_ev *));
|
ring.ev = malloc((size_t) ring.size * sizeof(struct ovni_ev *));
|
||||||
|
|
||||||
if (ring.ev == NULL)
|
if (ring.ev == NULL)
|
||||||
die("malloc failed:");
|
die("malloc failed:");
|
||||||
@ -511,7 +511,7 @@ parse_args(int argc, char *argv[])
|
|||||||
operation_mode = CHECK;
|
operation_mode = CHECK;
|
||||||
break;
|
break;
|
||||||
case 'n':
|
case 'n':
|
||||||
max_look_back = atol(optarg);
|
max_look_back = (size_t) atol(optarg);
|
||||||
break;
|
break;
|
||||||
default: /* '?' */
|
default: /* '?' */
|
||||||
usage();
|
usage();
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (c) 2021-2023 Barcelona Supercomputing Center (BSC)
|
/* Copyright (c) 2021-2024 Barcelona Supercomputing Center (BSC)
|
||||||
* SPDX-License-Identifier: GPL-3.0-or-later */
|
* SPDX-License-Identifier: GPL-3.0-or-later */
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
@ -182,7 +182,7 @@ fill_offset(struct offset *offset, int nsamples)
|
|||||||
static void
|
static void
|
||||||
offset_compute_delta(struct offset *ref, struct offset *cur, int nsamples, int verbose)
|
offset_compute_delta(struct offset *ref, struct offset *cur, int nsamples, int verbose)
|
||||||
{
|
{
|
||||||
double *delta = malloc(sizeof(double) * nsamples);
|
double *delta = malloc(sizeof(double) * (size_t) nsamples);
|
||||||
|
|
||||||
if (delta == NULL) {
|
if (delta == NULL) {
|
||||||
perror("malloc");
|
perror("malloc");
|
||||||
@ -199,7 +199,7 @@ offset_compute_delta(struct offset *ref, struct offset *cur, int nsamples, int v
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
qsort(delta, nsamples, sizeof(double), cmp_double);
|
qsort(delta, (size_t) nsamples, sizeof(double), cmp_double);
|
||||||
|
|
||||||
cur->delta_median = delta[nsamples / 2];
|
cur->delta_median = delta[nsamples / 2];
|
||||||
cur->delta_mean = 0;
|
cur->delta_mean = 0;
|
||||||
@ -223,14 +223,14 @@ offset_compute_delta(struct offset *ref, struct offset *cur, int nsamples, int v
|
|||||||
static size_t
|
static size_t
|
||||||
offset_size(int nsamples)
|
offset_size(int nsamples)
|
||||||
{
|
{
|
||||||
return sizeof(struct offset) + sizeof(double) * nsamples;
|
return sizeof(struct offset) + sizeof(double) * (size_t) nsamples;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct offset *
|
static struct offset *
|
||||||
table_get_offset(struct offset_table *table, int i, int nsamples)
|
table_get_offset(struct offset_table *table, int i, int nsamples)
|
||||||
{
|
{
|
||||||
char *p = (char *) table->_offset;
|
char *p = (char *) table->_offset;
|
||||||
p += i * offset_size(nsamples);
|
p += (size_t) i * offset_size(nsamples);
|
||||||
|
|
||||||
return (struct offset *) p;
|
return (struct offset *) p;
|
||||||
}
|
}
|
||||||
@ -252,14 +252,14 @@ build_offset_table(int nsamples, int rank, int verbose)
|
|||||||
|
|
||||||
MPI_Comm_size(MPI_COMM_WORLD, &table->nprocs);
|
MPI_Comm_size(MPI_COMM_WORLD, &table->nprocs);
|
||||||
|
|
||||||
table->_offset = calloc(table->nprocs, offset_size(nsamples));
|
table->_offset = calloc((size_t) table->nprocs, offset_size(nsamples));
|
||||||
|
|
||||||
if (table->_offset == NULL) {
|
if (table->_offset == NULL) {
|
||||||
perror("malloc");
|
perror("malloc");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
table->offset = malloc(sizeof(struct offset *) * table->nprocs);
|
table->offset = malloc(sizeof(struct offset *) * (size_t) table->nprocs);
|
||||||
|
|
||||||
if (table->offset == NULL) {
|
if (table->offset == NULL) {
|
||||||
perror("malloc");
|
perror("malloc");
|
||||||
@ -288,8 +288,8 @@ build_offset_table(int nsamples, int rank, int verbose)
|
|||||||
void *sendbuf = rank == 0 ? MPI_IN_PLACE : offset;
|
void *sendbuf = rank == 0 ? MPI_IN_PLACE : offset;
|
||||||
|
|
||||||
/* Then collect all the offsets into the rank 0 */
|
/* Then collect all the offsets into the rank 0 */
|
||||||
MPI_Gather(sendbuf, offset_size(nsamples), MPI_CHAR,
|
MPI_Gather(sendbuf, (int) offset_size(nsamples), MPI_CHAR,
|
||||||
offset, offset_size(nsamples), MPI_CHAR,
|
offset, (int) offset_size(nsamples), MPI_CHAR,
|
||||||
0, MPI_COMM_WORLD);
|
0, MPI_COMM_WORLD);
|
||||||
|
|
||||||
/* Finish the offsets by computing the deltas on rank 0 */
|
/* Finish the offsets by computing the deltas on rank 0 */
|
||||||
@ -399,7 +399,7 @@ do_work(struct options *options, int rank)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (drift_mode)
|
if (drift_mode)
|
||||||
sleep(options->drift_wait);
|
sleep((unsigned) options->drift_wait);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rank == 0)
|
if (rank == 0)
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (c) 2021-2023 Barcelona Supercomputing Center (BSC)
|
/* Copyright (c) 2021-2024 Barcelona Supercomputing Center (BSC)
|
||||||
* SPDX-License-Identifier: GPL-3.0-or-later */
|
* SPDX-License-Identifier: GPL-3.0-or-later */
|
||||||
|
|
||||||
#include "path.h"
|
#include "path.h"
|
||||||
@ -95,7 +95,7 @@ path_keep(char *path, int n)
|
|||||||
void
|
void
|
||||||
path_remove_trailing(char *path)
|
path_remove_trailing(char *path)
|
||||||
{
|
{
|
||||||
int n = strlen(path);
|
int n = (int) strlen(path);
|
||||||
for (int i = n - 1; i >= 0 && path[i] == '/'; i--) {
|
for (int i = n - 1; i >= 0 && path[i] == '/'; i--) {
|
||||||
path[i] = '\0';
|
path[i] = '\0';
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (c) 2021-2023 Barcelona Supercomputing Center (BSC)
|
/* Copyright (c) 2021-2024 Barcelona Supercomputing Center (BSC)
|
||||||
* SPDX-License-Identifier: GPL-3.0-or-later */
|
* SPDX-License-Identifier: GPL-3.0-or-later */
|
||||||
|
|
||||||
#include "prf.h"
|
#include "prf.h"
|
||||||
@ -20,7 +20,7 @@ prf_open(struct prf *prf, const char *path, long nrows)
|
|||||||
}
|
}
|
||||||
|
|
||||||
prf->nrows = nrows;
|
prf->nrows = nrows;
|
||||||
prf->rows = calloc(nrows, sizeof(struct prf_row));
|
prf->rows = calloc((size_t) nrows, sizeof(struct prf_row));
|
||||||
|
|
||||||
if (prf->rows == NULL) {
|
if (prf->rows == NULL) {
|
||||||
err("calloc failed:");
|
err("calloc failed:");
|
||||||
|
@ -25,7 +25,7 @@ prv_open_file(struct prv *prv, long nrows, FILE *file)
|
|||||||
prv->file = file;
|
prv->file = file;
|
||||||
|
|
||||||
/* Write fake header to allocate the space */
|
/* Write fake header to allocate the space */
|
||||||
write_header(file, 0LL, nrows);
|
write_header(file, 0LL, (int) nrows);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -48,7 +48,7 @@ prv_close(struct prv *prv)
|
|||||||
{
|
{
|
||||||
/* Fix the header with the current duration */
|
/* Fix the header with the current duration */
|
||||||
fseek(prv->file, 0, SEEK_SET);
|
fseek(prv->file, 0, SEEK_SET);
|
||||||
write_header(prv->file, prv->time, prv->nrows);
|
write_header(prv->file, prv->time, (int) prv->nrows);
|
||||||
fclose(prv->file);
|
fclose(prv->file);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -106,8 +106,8 @@ sort_cb_input(struct chan *in_chan, void *ptr)
|
|||||||
if (likely(sort->copied)) {
|
if (likely(sort->copied)) {
|
||||||
sort_replace(sort->sorted, sort->n, old, new);
|
sort_replace(sort->sorted, sort->n, old, new);
|
||||||
} else {
|
} else {
|
||||||
memcpy(sort->sorted, sort->values, sort->n * sizeof(int64_t));
|
memcpy(sort->sorted, sort->values, (size_t) sort->n * sizeof(int64_t));
|
||||||
qsort(sort->sorted, sort->n, sizeof(int64_t), cmp_int64);
|
qsort(sort->sorted, (size_t) sort->n, sizeof(int64_t), cmp_int64);
|
||||||
sort->copied = 1;
|
sort->copied = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -141,22 +141,22 @@ sort_init(struct sort *sort, struct bay *bay, int64_t n, const char *name)
|
|||||||
memset(sort, 0, sizeof(struct sort));
|
memset(sort, 0, sizeof(struct sort));
|
||||||
sort->bay = bay;
|
sort->bay = bay;
|
||||||
sort->n = n;
|
sort->n = n;
|
||||||
sort->inputs = calloc(n, sizeof(struct sort_input));
|
sort->inputs = calloc((size_t) n, sizeof(struct sort_input));
|
||||||
if (sort->inputs == NULL) {
|
if (sort->inputs == NULL) {
|
||||||
err("calloc failed:");
|
err("calloc failed:");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
sort->outputs = calloc(n, sizeof(struct chan));
|
sort->outputs = calloc((size_t) n, sizeof(struct chan));
|
||||||
if (sort->outputs == NULL) {
|
if (sort->outputs == NULL) {
|
||||||
err("calloc failed:");
|
err("calloc failed:");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
sort->values = calloc(n, sizeof(int64_t));
|
sort->values = calloc((size_t) n, sizeof(int64_t));
|
||||||
if (sort->values == NULL) {
|
if (sort->values == NULL) {
|
||||||
err("calloc failed:");
|
err("calloc failed:");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
sort->sorted = calloc(n, sizeof(int64_t));
|
sort->sorted = calloc((size_t) n, sizeof(int64_t));
|
||||||
if (sort->sorted == NULL) {
|
if (sort->sorted == NULL) {
|
||||||
err("calloc failed:");
|
err("calloc failed:");
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -59,7 +59,7 @@ load_stream_fd(struct stream *stream, int fd)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int prot = PROT_READ | PROT_WRITE;
|
int prot = PROT_READ | PROT_WRITE;
|
||||||
stream->buf = mmap(NULL, st.st_size, prot, MAP_PRIVATE, fd, 0);
|
stream->buf = mmap(NULL, (size_t) st.st_size, prot, MAP_PRIVATE, fd, 0);
|
||||||
|
|
||||||
if (stream->buf == MAP_FAILED) {
|
if (stream->buf == MAP_FAILED) {
|
||||||
err("mmap failed:");
|
err("mmap failed:");
|
||||||
@ -241,7 +241,7 @@ stream_step(struct stream *stream)
|
|||||||
void
|
void
|
||||||
stream_progress(struct stream *stream, int64_t *done, int64_t *total)
|
stream_progress(struct stream *stream, int64_t *done, int64_t *total)
|
||||||
{
|
{
|
||||||
*done = stream->offset - sizeof(struct ovni_stream_header);
|
*done = stream->offset - (int64_t) sizeof(struct ovni_stream_header);
|
||||||
*total = stream->usize;
|
*total = stream->usize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -226,7 +226,7 @@ create_system(struct system *sys, struct trace *trace)
|
|||||||
const char *dir = trace->tracedir;
|
const char *dir = trace->tracedir;
|
||||||
|
|
||||||
/* Allocate the lpt map */
|
/* Allocate the lpt map */
|
||||||
sys->lpt = calloc(trace->nstreams, sizeof(struct lpt));
|
sys->lpt = calloc((size_t) trace->nstreams, sizeof(struct lpt));
|
||||||
if (sys->lpt == NULL) {
|
if (sys->lpt == NULL) {
|
||||||
err("calloc failed:");
|
err("calloc failed:");
|
||||||
return -1;
|
return -1;
|
||||||
@ -373,20 +373,20 @@ init_global_indices(struct system *sys)
|
|||||||
{
|
{
|
||||||
size_t iloom = 0;
|
size_t iloom = 0;
|
||||||
for (struct loom *l = sys->looms; l; l = l->next)
|
for (struct loom *l = sys->looms; l; l = l->next)
|
||||||
loom_set_gindex(l, iloom++);
|
loom_set_gindex(l, (int64_t) iloom++);
|
||||||
|
|
||||||
sys->nprocs = 0;
|
sys->nprocs = 0;
|
||||||
for (struct proc *p = sys->procs; p; p = p->gnext)
|
for (struct proc *p = sys->procs; p; p = p->gnext)
|
||||||
proc_set_gindex(p, sys->nprocs++);
|
proc_set_gindex(p, (int64_t) sys->nprocs++);
|
||||||
|
|
||||||
sys->nthreads = 0;
|
sys->nthreads = 0;
|
||||||
for (struct thread *t = sys->threads; t; t = t->gnext)
|
for (struct thread *t = sys->threads; t; t = t->gnext)
|
||||||
thread_set_gindex(t, sys->nthreads++);
|
thread_set_gindex(t, (int64_t) sys->nthreads++);
|
||||||
|
|
||||||
sys->ncpus = 0;
|
sys->ncpus = 0;
|
||||||
sys->nphycpus = 0;
|
sys->nphycpus = 0;
|
||||||
for (struct cpu *c = sys->cpus; c; c = c->next) {
|
for (struct cpu *c = sys->cpus; c; c = c->next) {
|
||||||
cpu_set_gindex(c, sys->ncpus++);
|
cpu_set_gindex(c, (int64_t) sys->ncpus++);
|
||||||
if (!c->is_virtual)
|
if (!c->is_virtual)
|
||||||
sys->nphycpus++;
|
sys->nphycpus++;
|
||||||
}
|
}
|
||||||
@ -641,13 +641,13 @@ system_connect(struct system *sys, struct bay *bay, struct recorder *rec)
|
|||||||
{
|
{
|
||||||
/* Create Paraver traces */
|
/* Create Paraver traces */
|
||||||
struct pvt *pvt_cpu = NULL;
|
struct pvt *pvt_cpu = NULL;
|
||||||
if ((pvt_cpu = recorder_add_pvt(rec, "cpu", sys->ncpus)) == NULL) {
|
if ((pvt_cpu = recorder_add_pvt(rec, "cpu", (long) sys->ncpus)) == NULL) {
|
||||||
err("recorder_add_pvt failed");
|
err("recorder_add_pvt failed");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct pvt *pvt_th = NULL;
|
struct pvt *pvt_th = NULL;
|
||||||
if ((pvt_th = recorder_add_pvt(rec, "thread", sys->nthreads)) == NULL) {
|
if ((pvt_th = recorder_add_pvt(rec, "thread", (long) sys->nthreads)) == NULL) {
|
||||||
err("recorder_add_pvt failed");
|
err("recorder_add_pvt failed");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -667,7 +667,7 @@ system_connect(struct system *sys, struct bay *bay, struct recorder *rec)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (prf_add(prf, th->gindex, name) != 0) {
|
if (prf_add(prf, (long) th->gindex, name) != 0) {
|
||||||
err("prf_add failed for thread '%s'", th->id);
|
err("prf_add failed for thread '%s'", th->id);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -688,7 +688,7 @@ system_connect(struct system *sys, struct bay *bay, struct recorder *rec)
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct prf *prf = pvt_get_prf(pvt_cpu);
|
struct prf *prf = pvt_get_prf(pvt_cpu);
|
||||||
if (prf_add(prf, cpu->gindex, cpu->name) != 0) {
|
if (prf_add(prf, (long) cpu->gindex, cpu->name) != 0) {
|
||||||
err("prf_add failed for cpu '%s'", cpu->name);
|
err("prf_add failed for cpu '%s'", cpu->name);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -288,7 +288,7 @@ task_create_pcf_types(struct pcf_type *pcftype, struct task_type *types)
|
|||||||
|
|
||||||
/* Emit types for all task types */
|
/* Emit types for all task types */
|
||||||
for (struct task_type *tt = types; tt != NULL; tt = tt->hh.next) {
|
for (struct task_type *tt = types; tt != NULL; tt = tt->hh.next) {
|
||||||
struct pcf_value *pcfvalue = pcf_find_value(pcftype, tt->gid);
|
struct pcf_value *pcfvalue = pcf_find_value(pcftype, (int) tt->gid);
|
||||||
if (pcfvalue != NULL) {
|
if (pcfvalue != NULL) {
|
||||||
/* Ensure the label is the same, so we know that
|
/* Ensure the label is the same, so we know that
|
||||||
* no collision occurred */
|
* no collision occurred */
|
||||||
@ -301,7 +301,7 @@ task_create_pcf_types(struct pcf_type *pcftype, struct task_type *types)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pcf_add_value(pcftype, tt->gid, tt->label) == NULL) {
|
if (pcf_add_value(pcftype, (int) tt->gid, tt->label) == NULL) {
|
||||||
err("pcf_add_value failed");
|
err("pcf_add_value failed");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -91,7 +91,7 @@ get_tid(const char *id, int *tid)
|
|||||||
|
|
||||||
char *endptr;
|
char *endptr;
|
||||||
errno = 0;
|
errno = 0;
|
||||||
*tid = strtol(tidstr, &endptr, 10);
|
*tid = (int) strtol(tidstr, &endptr, 10);
|
||||||
if (errno != 0) {
|
if (errno != 0) {
|
||||||
err("strtol failed for '%s':", tidstr);
|
err("strtol failed for '%s':", tidstr);
|
||||||
return -1;
|
return -1;
|
||||||
@ -196,7 +196,7 @@ create_type(struct pcf *pcf, int i)
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
const char *label = pvt_name[i];
|
const char *label = pvt_name[i];
|
||||||
struct pcf_type *pcftype = pcf_add_type(pcf, type, label);
|
struct pcf_type *pcftype = pcf_add_type(pcf, (int) type, label);
|
||||||
if (pcftype == NULL) {
|
if (pcftype == NULL) {
|
||||||
err("pcf_add_type failed");
|
err("pcf_add_type failed");
|
||||||
return -1;
|
return -1;
|
||||||
@ -234,7 +234,7 @@ thread_connect(struct thread *th, struct bay *bay, struct recorder *rec)
|
|||||||
}
|
}
|
||||||
|
|
||||||
long type = chan_type[i];
|
long type = chan_type[i];
|
||||||
long row = th->gindex;
|
long row = (long) th->gindex;
|
||||||
long flags = prv_flags[i];
|
long flags = prv_flags[i];
|
||||||
|
|
||||||
if (prv_register(prv, row, type, bay, c, flags)) {
|
if (prv_register(prv, row, type, bay, c, flags)) {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (c) 2021-2023 Barcelona Supercomputing Center (BSC)
|
/* Copyright (c) 2021-2024 Barcelona Supercomputing Center (BSC)
|
||||||
* SPDX-License-Identifier: GPL-3.0-or-later */
|
* SPDX-License-Identifier: GPL-3.0-or-later */
|
||||||
|
|
||||||
#define _XOPEN_SOURCE 500
|
#define _XOPEN_SOURCE 500
|
||||||
@ -36,7 +36,7 @@ load_stream(struct trace *trace, const char *path)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int offset = strlen(trace->tracedir);
|
int offset = (int) strlen(trace->tracedir);
|
||||||
const char *relpath = path + offset;
|
const char *relpath = path + offset;
|
||||||
|
|
||||||
/* Skip begin slashes */
|
/* Skip begin slashes */
|
||||||
@ -58,14 +58,14 @@ has_suffix(const char *str, const char *suffix)
|
|||||||
if (!str || !suffix)
|
if (!str || !suffix)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
int lenstr = strlen(str);
|
int lenstr = (int) strlen(str);
|
||||||
int lensuffix = strlen(suffix);
|
int lensuffix = (int) strlen(suffix);
|
||||||
|
|
||||||
if (lensuffix > lenstr)
|
if (lensuffix > lenstr)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
const char *p = str + lenstr - lensuffix;
|
const char *p = str + lenstr - lensuffix;
|
||||||
if (strncmp(p, suffix, lensuffix) == 0)
|
if (strncmp(p, suffix, (size_t) lensuffix) == 0)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -23,8 +23,8 @@ track_init(struct track *track, struct bay *bay, enum track_type type, int mode,
|
|||||||
va_list ap;
|
va_list ap;
|
||||||
va_start(ap, fmt);
|
va_start(ap, fmt);
|
||||||
|
|
||||||
int n = ARRAYLEN(track->name);
|
int n = (int) ARRAYLEN(track->name);
|
||||||
int ret = vsnprintf(track->name, n, fmt, ap);
|
int ret = vsnprintf(track->name, (size_t) n, fmt, ap);
|
||||||
if (ret >= n) {
|
if (ret >= n) {
|
||||||
err("track name too long");
|
err("track name too long");
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -117,11 +117,11 @@ leading_zeros(size_t x)
|
|||||||
{
|
{
|
||||||
/* Call and if()'s optimized by the compiler with -O2 */
|
/* Call and if()'s optimized by the compiler with -O2 */
|
||||||
if (sizeof(size_t) == sizeof(unsigned int))
|
if (sizeof(size_t) == sizeof(unsigned int))
|
||||||
return __builtin_clz(x);
|
return __builtin_clz((unsigned int) x);
|
||||||
else if (sizeof(size_t) == sizeof(unsigned long))
|
else if (sizeof(size_t) == sizeof(unsigned long))
|
||||||
return __builtin_clzl(x);
|
return __builtin_clzl((unsigned long) x);
|
||||||
else if (sizeof(size_t) == sizeof(unsigned long long))
|
else if (sizeof(size_t) == sizeof(unsigned long long))
|
||||||
return __builtin_clzll(x);
|
return __builtin_clzll((unsigned long long) x);
|
||||||
else
|
else
|
||||||
die("cannot find suitable size for __builtin_clz*");
|
die("cannot find suitable size for __builtin_clz*");
|
||||||
}
|
}
|
||||||
@ -133,7 +133,7 @@ heap_get_move(size_t *node /*out*/)
|
|||||||
size_t aux_node = *node;
|
size_t aux_node = *node;
|
||||||
|
|
||||||
// Round to previous po2
|
// Round to previous po2
|
||||||
int shift = sizeof(size_t) * 8 - leading_zeros(aux_node) - 1;
|
int shift = (int) sizeof(size_t) * 8 - leading_zeros(aux_node) - 1;
|
||||||
size_t base = 1ULL << shift;
|
size_t base = 1ULL << shift;
|
||||||
|
|
||||||
aux_node -= base / 2;
|
aux_node -= base / 2;
|
||||||
|
32
src/parson.c
32
src/parson.c
@ -316,7 +316,7 @@ read_file(const char *filename)
|
|||||||
fclose(fp);
|
fclose(fp);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
size_to_read = pos;
|
size_to_read = (size_t) pos;
|
||||||
rewind(fp);
|
rewind(fp);
|
||||||
file_contents = (char *) parson_malloc(sizeof(char) * (size_to_read + 1));
|
file_contents = (char *) parson_malloc(sizeof(char) * (size_to_read + 1));
|
||||||
if (!file_contents) {
|
if (!file_contents) {
|
||||||
@ -361,7 +361,7 @@ remove_comments(char *string, const char *start_token, const char *end_token)
|
|||||||
if (!ptr) {
|
if (!ptr) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (i = 0; i < (ptr - string) + end_token_len; i++) {
|
for (i = 0; i < (size_t) (ptr - string) + end_token_len; i++) {
|
||||||
string[i] = ' ';
|
string[i] = ' ';
|
||||||
}
|
}
|
||||||
string = ptr + end_token_len - 1;
|
string = ptr + end_token_len - 1;
|
||||||
@ -503,7 +503,7 @@ json_object_dotremove_internal(JSON_Object *object, const char *name, int free_v
|
|||||||
if (dot_pos == NULL) {
|
if (dot_pos == NULL) {
|
||||||
return json_object_remove_internal(object, name, free_value);
|
return json_object_remove_internal(object, name, free_value);
|
||||||
}
|
}
|
||||||
temp_value = json_object_getn_value(object, name, dot_pos - name);
|
temp_value = json_object_getn_value(object, name, (size_t) (dot_pos - name));
|
||||||
if (json_value_get_type(temp_value) != JSONObject) {
|
if (json_value_get_type(temp_value) != JSONObject) {
|
||||||
return JSONFailure;
|
return JSONFailure;
|
||||||
}
|
}
|
||||||
@ -638,13 +638,13 @@ parse_utf16(const char **unprocessed, char **processed)
|
|||||||
if (cp < 0x80) {
|
if (cp < 0x80) {
|
||||||
processed_ptr[0] = (char) cp; /* 0xxxxxxx */
|
processed_ptr[0] = (char) cp; /* 0xxxxxxx */
|
||||||
} else if (cp < 0x800) {
|
} else if (cp < 0x800) {
|
||||||
processed_ptr[0] = ((cp >> 6) & 0x1F) | 0xC0; /* 110xxxxx */
|
processed_ptr[0] = (char) (((cp >> 6) & 0x1F) | 0xC0); /* 110xxxxx */
|
||||||
processed_ptr[1] = ((cp) &0x3F) | 0x80; /* 10xxxxxx */
|
processed_ptr[1] = (char) (((cp) &0x3F) | 0x80); /* 10xxxxxx */
|
||||||
processed_ptr += 1;
|
processed_ptr += 1;
|
||||||
} else if (cp < 0xD800 || cp > 0xDFFF) {
|
} else if (cp < 0xD800 || cp > 0xDFFF) {
|
||||||
processed_ptr[0] = ((cp >> 12) & 0x0F) | 0xE0; /* 1110xxxx */
|
processed_ptr[0] = (char) (((cp >> 12) & 0x0F) | 0xE0);/* 1110xxxx */
|
||||||
processed_ptr[1] = ((cp >> 6) & 0x3F) | 0x80; /* 10xxxxxx */
|
processed_ptr[1] = (char) (((cp >> 6) & 0x3F) | 0x80); /* 10xxxxxx */
|
||||||
processed_ptr[2] = ((cp) &0x3F) | 0x80; /* 10xxxxxx */
|
processed_ptr[2] = (char) (((cp) &0x3F) | 0x80); /* 10xxxxxx */
|
||||||
processed_ptr += 2;
|
processed_ptr += 2;
|
||||||
} else if (cp >= 0xD800 && cp <= 0xDBFF) { /* lead surrogate (0xD800..0xDBFF) */
|
} else if (cp >= 0xD800 && cp <= 0xDBFF) { /* lead surrogate (0xD800..0xDBFF) */
|
||||||
lead = cp;
|
lead = cp;
|
||||||
@ -657,10 +657,10 @@ parse_utf16(const char **unprocessed, char **processed)
|
|||||||
return JSONFailure;
|
return JSONFailure;
|
||||||
}
|
}
|
||||||
cp = ((((lead - 0xD800) & 0x3FF) << 10) | ((trail - 0xDC00) & 0x3FF)) + 0x010000;
|
cp = ((((lead - 0xD800) & 0x3FF) << 10) | ((trail - 0xDC00) & 0x3FF)) + 0x010000;
|
||||||
processed_ptr[0] = (((cp >> 18) & 0x07) | 0xF0); /* 11110xxx */
|
processed_ptr[0] = (char) (((cp >> 18) & 0x07) | 0xF0); /* 11110xxx */
|
||||||
processed_ptr[1] = (((cp >> 12) & 0x3F) | 0x80); /* 10xxxxxx */
|
processed_ptr[1] = (char) (((cp >> 12) & 0x3F) | 0x80); /* 10xxxxxx */
|
||||||
processed_ptr[2] = (((cp >> 6) & 0x3F) | 0x80); /* 10xxxxxx */
|
processed_ptr[2] = (char) (((cp >> 6) & 0x3F) | 0x80); /* 10xxxxxx */
|
||||||
processed_ptr[3] = (((cp) &0x3F) | 0x80); /* 10xxxxxx */
|
processed_ptr[3] = (char) (((cp) &0x3F) | 0x80); /* 10xxxxxx */
|
||||||
processed_ptr += 3;
|
processed_ptr += 3;
|
||||||
} else { /* trail surrogate before lead surrogate */
|
} else { /* trail surrogate before lead surrogate */
|
||||||
return JSONFailure;
|
return JSONFailure;
|
||||||
@ -758,7 +758,7 @@ get_quoted_string(const char **string, size_t *output_string_len)
|
|||||||
if (status != JSONSuccess) {
|
if (status != JSONSuccess) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
input_string_len = *string - string_start - 2; /* length without quotes */
|
input_string_len = (size_t) (*string - string_start - 2); /* length without quotes */
|
||||||
return process_string(string_start + 1, input_string_len, output_string_len);
|
return process_string(string_start + 1, input_string_len, output_string_len);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -957,7 +957,7 @@ parse_number_value(const char **string)
|
|||||||
if (errno == ERANGE && (number == -HUGE_VAL || number == HUGE_VAL)) {
|
if (errno == ERANGE && (number == -HUGE_VAL || number == HUGE_VAL)) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if ((errno && errno != ERANGE) || !is_decimal(*string, end - *string)) {
|
if ((errno && errno != ERANGE) || !is_decimal(*string, (size_t) (end - *string))) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
*string = end;
|
*string = end;
|
||||||
@ -1410,7 +1410,7 @@ json_object_dotget_value(const JSON_Object *object, const char *name)
|
|||||||
if (!dot_position) {
|
if (!dot_position) {
|
||||||
return json_object_get_value(object, name);
|
return json_object_get_value(object, name);
|
||||||
}
|
}
|
||||||
object = json_value_get_object(json_object_getn_value(object, name, dot_position - name));
|
object = json_value_get_object(json_object_getn_value(object, name, (size_t) (dot_position - name)));
|
||||||
return json_object_dotget_value(object, dot_position + 1);
|
return json_object_dotget_value(object, dot_position + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2253,7 +2253,7 @@ json_object_dotset_value(JSON_Object *object, const char *name, JSON_Value *valu
|
|||||||
if (dot_pos == NULL) {
|
if (dot_pos == NULL) {
|
||||||
return json_object_set_value(object, name, value);
|
return json_object_set_value(object, name, value);
|
||||||
}
|
}
|
||||||
name_len = dot_pos - name;
|
name_len = (size_t) (dot_pos - name);
|
||||||
temp_value = json_object_getn_value(object, name, name_len);
|
temp_value = json_object_getn_value(object, name, name_len);
|
||||||
if (temp_value) {
|
if (temp_value) {
|
||||||
/* Don't overwrite existing non-object (unlike json_object_set_value, but it shouldn't be changed at this point) */
|
/* Don't overwrite existing non-object (unlike json_object_set_value, but it shouldn't be changed at this point) */
|
||||||
|
@ -435,8 +435,8 @@ write_evbuf(uint8_t *buf, size_t size)
|
|||||||
if (written < 0)
|
if (written < 0)
|
||||||
die("failed to write buffer to disk:");
|
die("failed to write buffer to disk:");
|
||||||
|
|
||||||
size -= written;
|
size -= (size_t) written;
|
||||||
buf += written;
|
buf += (size_t) written;
|
||||||
} while (size > 0);
|
} while (size > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -638,7 +638,7 @@ clock_monotonic_now(void)
|
|||||||
if (clock_gettime(rproc.clockid, &tp))
|
if (clock_gettime(rproc.clockid, &tp))
|
||||||
die("clock_gettime() failed:");
|
die("clock_gettime() failed:");
|
||||||
|
|
||||||
return tp.tv_sec * ns + tp.tv_nsec;
|
return (uint64_t) tp.tv_sec * ns + (uint64_t) tp.tv_nsec;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t
|
uint64_t
|
||||||
@ -666,9 +666,9 @@ ovni_ev_get_clock(const struct ovni_ev *ev)
|
|||||||
void
|
void
|
||||||
ovni_ev_set_mcv(struct ovni_ev *ev, const char *mcv)
|
ovni_ev_set_mcv(struct ovni_ev *ev, const char *mcv)
|
||||||
{
|
{
|
||||||
ev->header.model = mcv[0];
|
ev->header.model = (uint8_t) mcv[0];
|
||||||
ev->header.category = mcv[1];
|
ev->header.category = (uint8_t) mcv[1];
|
||||||
ev->header.value = mcv[2];
|
ev->header.value = (uint8_t) mcv[2];
|
||||||
}
|
}
|
||||||
|
|
||||||
static size_t
|
static size_t
|
||||||
@ -681,7 +681,7 @@ int
|
|||||||
ovni_payload_size(const struct ovni_ev *ev)
|
ovni_payload_size(const struct ovni_ev *ev)
|
||||||
{
|
{
|
||||||
if (ev->header.flags & OVNI_EV_JUMBO)
|
if (ev->header.flags & OVNI_EV_JUMBO)
|
||||||
return get_jumbo_payload_size(ev);
|
return (int) get_jumbo_payload_size(ev);
|
||||||
|
|
||||||
int size = ev->header.flags & 0x0f;
|
int size = ev->header.flags & 0x0f;
|
||||||
|
|
||||||
@ -704,22 +704,23 @@ ovni_payload_add(struct ovni_ev *ev, const uint8_t *buf, int size)
|
|||||||
if (size < 2)
|
if (size < 2)
|
||||||
die("payload size %d too small", size);
|
die("payload size %d too small", size);
|
||||||
|
|
||||||
size_t payload_size = ovni_payload_size(ev);
|
size_t payload_size = (size_t) ovni_payload_size(ev);
|
||||||
|
|
||||||
/* Ensure we have room */
|
/* Ensure we have room */
|
||||||
if (payload_size + size > sizeof(ev->payload))
|
if (payload_size + (size_t) size > sizeof(ev->payload))
|
||||||
die("no space left for %d bytes", size);
|
die("no space left for %d bytes", size);
|
||||||
|
|
||||||
memcpy(&ev->payload.u8[payload_size], buf, size);
|
memcpy(&ev->payload.u8[payload_size], buf, (size_t) size);
|
||||||
payload_size += size;
|
payload_size += (size_t) size;
|
||||||
|
|
||||||
ev->header.flags = (ev->header.flags & 0xf0) | ((payload_size - 1) & 0x0f);
|
ev->header.flags = (uint8_t) ((ev->header.flags & 0xf0)
|
||||||
|
| ((payload_size - 1) & 0x0f));
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
ovni_ev_size(const struct ovni_ev *ev)
|
ovni_ev_size(const struct ovni_ev *ev)
|
||||||
{
|
{
|
||||||
return sizeof(ev->header) + ovni_payload_size(ev);
|
return (int) sizeof(ev->header) + ovni_payload_size(ev);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -778,7 +779,7 @@ ovni_ev_add_jumbo(struct ovni_ev *ev, const uint8_t *buf, uint32_t bufsize)
|
|||||||
die("the event payload must be empty");
|
die("the event payload must be empty");
|
||||||
|
|
||||||
ovni_payload_add(ev, (uint8_t *) &bufsize, sizeof(bufsize));
|
ovni_payload_add(ev, (uint8_t *) &bufsize, sizeof(bufsize));
|
||||||
size_t evsize = ovni_ev_size(ev);
|
size_t evsize = (size_t) ovni_ev_size(ev);
|
||||||
|
|
||||||
size_t totalsize = evsize + bufsize;
|
size_t totalsize = evsize + bufsize;
|
||||||
|
|
||||||
@ -818,7 +819,7 @@ ovni_ev_add(struct ovni_ev *ev)
|
|||||||
int flushed = 0;
|
int flushed = 0;
|
||||||
uint64_t t0, t1;
|
uint64_t t0, t1;
|
||||||
|
|
||||||
int size = ovni_ev_size(ev);
|
size_t size = (size_t) ovni_ev_size(ev);
|
||||||
|
|
||||||
/* Check if the event fits or flush first otherwise */
|
/* Check if the event fits or flush first otherwise */
|
||||||
if (rthread.evlen + size >= OVNI_MAX_EV_BUF) {
|
if (rthread.evlen + size >= OVNI_MAX_EV_BUF) {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (c) 2021-2023 Barcelona Supercomputing Center (BSC)
|
/* Copyright (c) 2021-2024 Barcelona Supercomputing Center (BSC)
|
||||||
* SPDX-License-Identifier: GPL-3.0-or-later */
|
* SPDX-License-Identifier: GPL-3.0-or-later */
|
||||||
|
|
||||||
#include "instr.h"
|
#include "instr.h"
|
||||||
@ -9,7 +9,7 @@ int64_t last_clock; /* Clock from the last event */
|
|||||||
|
|
||||||
int64_t get_clock(void)
|
int64_t get_clock(void)
|
||||||
{
|
{
|
||||||
last_clock = ovni_clock_now();
|
last_clock = (int64_t) ovni_clock_now();
|
||||||
if (first_clock_set == 0) {
|
if (first_clock_set == 0) {
|
||||||
first_clock = last_clock;
|
first_clock = last_clock;
|
||||||
first_clock_set = 1;
|
first_clock_set = 1;
|
||||||
|
@ -23,7 +23,7 @@ int64_t get_delta(void);
|
|||||||
static inline void name(void) \
|
static inline void name(void) \
|
||||||
{ \
|
{ \
|
||||||
struct ovni_ev ev = {0}; \
|
struct ovni_ev ev = {0}; \
|
||||||
ovni_ev_set_clock(&ev, get_clock()); \
|
ovni_ev_set_clock(&ev, (uint64_t) get_clock()); \
|
||||||
ovni_ev_set_mcv(&ev, mcv); \
|
ovni_ev_set_mcv(&ev, mcv); \
|
||||||
ovni_ev_emit(&ev); \
|
ovni_ev_emit(&ev); \
|
||||||
}
|
}
|
||||||
@ -32,7 +32,7 @@ int64_t get_delta(void);
|
|||||||
static inline void name(ta a) \
|
static inline void name(ta a) \
|
||||||
{ \
|
{ \
|
||||||
struct ovni_ev ev = {0}; \
|
struct ovni_ev ev = {0}; \
|
||||||
ovni_ev_set_clock(&ev, get_clock()); \
|
ovni_ev_set_clock(&ev, (uint64_t) get_clock()); \
|
||||||
ovni_ev_set_mcv(&ev, mcv); \
|
ovni_ev_set_mcv(&ev, mcv); \
|
||||||
ovni_payload_add(&ev, (uint8_t *) &a, sizeof(a)); \
|
ovni_payload_add(&ev, (uint8_t *) &a, sizeof(a)); \
|
||||||
ovni_ev_emit(&ev); \
|
ovni_ev_emit(&ev); \
|
||||||
@ -42,7 +42,7 @@ int64_t get_delta(void);
|
|||||||
static inline void name(ta a, tb b) \
|
static inline void name(ta a, tb b) \
|
||||||
{ \
|
{ \
|
||||||
struct ovni_ev ev = {0}; \
|
struct ovni_ev ev = {0}; \
|
||||||
ovni_ev_set_clock(&ev, get_clock()); \
|
ovni_ev_set_clock(&ev, (uint64_t) get_clock()); \
|
||||||
ovni_ev_set_mcv(&ev, mcv); \
|
ovni_ev_set_mcv(&ev, mcv); \
|
||||||
ovni_payload_add(&ev, (uint8_t *) &a, sizeof(a)); \
|
ovni_payload_add(&ev, (uint8_t *) &a, sizeof(a)); \
|
||||||
ovni_payload_add(&ev, (uint8_t *) &b, sizeof(b)); \
|
ovni_payload_add(&ev, (uint8_t *) &b, sizeof(b)); \
|
||||||
@ -53,7 +53,7 @@ int64_t get_delta(void);
|
|||||||
static inline void name(ta a, tb b, tc c) \
|
static inline void name(ta a, tb b, tc c) \
|
||||||
{ \
|
{ \
|
||||||
struct ovni_ev ev = {0}; \
|
struct ovni_ev ev = {0}; \
|
||||||
ovni_ev_set_clock(&ev, get_clock()); \
|
ovni_ev_set_clock(&ev, (uint64_t) get_clock()); \
|
||||||
ovni_ev_set_mcv(&ev, mcv); \
|
ovni_ev_set_mcv(&ev, mcv); \
|
||||||
ovni_payload_add(&ev, (uint8_t *) &a, sizeof(a)); \
|
ovni_payload_add(&ev, (uint8_t *) &a, sizeof(a)); \
|
||||||
ovni_payload_add(&ev, (uint8_t *) &b, sizeof(b)); \
|
ovni_payload_add(&ev, (uint8_t *) &b, sizeof(b)); \
|
||||||
@ -72,7 +72,7 @@ instr_thread_end(void)
|
|||||||
struct ovni_ev ev = {0};
|
struct ovni_ev ev = {0};
|
||||||
|
|
||||||
ovni_ev_set_mcv(&ev, "OHe");
|
ovni_ev_set_mcv(&ev, "OHe");
|
||||||
ovni_ev_set_clock(&ev, get_clock());
|
ovni_ev_set_clock(&ev, (uint64_t) get_clock());
|
||||||
ovni_ev_emit(&ev);
|
ovni_ev_emit(&ev);
|
||||||
|
|
||||||
/* Flush the events to disk before killing the thread */
|
/* Flush the events to disk before killing the thread */
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (c) 2021-2023 Barcelona Supercomputing Center (BSC)
|
/* Copyright (c) 2021-2024 Barcelona Supercomputing Center (BSC)
|
||||||
* SPDX-License-Identifier: GPL-3.0-or-later */
|
* SPDX-License-Identifier: GPL-3.0-or-later */
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
@ -19,17 +19,17 @@ main(void)
|
|||||||
uint32_t typeid = 1;
|
uint32_t typeid = 1;
|
||||||
uint32_t taskid = 1;
|
uint32_t taskid = 1;
|
||||||
|
|
||||||
instr_nanos6_type_create(typeid);
|
instr_nanos6_type_create((int32_t) typeid);
|
||||||
|
|
||||||
instr_nanos6_task_create_and_execute(taskid, typeid);
|
instr_nanos6_task_create_and_execute((int32_t) taskid, typeid);
|
||||||
sleep_us(us);
|
sleep_us(us);
|
||||||
instr_nanos6_block_enter();
|
instr_nanos6_block_enter();
|
||||||
instr_nanos6_task_pause(taskid);
|
instr_nanos6_task_pause((int32_t) taskid);
|
||||||
sleep_us(us);
|
sleep_us(us);
|
||||||
instr_nanos6_task_resume(taskid);
|
instr_nanos6_task_resume((int32_t) taskid);
|
||||||
instr_nanos6_block_exit();
|
instr_nanos6_block_exit();
|
||||||
sleep_us(us);
|
sleep_us(us);
|
||||||
instr_nanos6_task_end(taskid);
|
instr_nanos6_task_end((int32_t) taskid);
|
||||||
instr_nanos6_task_body_exit();
|
instr_nanos6_task_body_exit();
|
||||||
|
|
||||||
instr_end();
|
instr_end();
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (c) 2023 Barcelona Supercomputing Center (BSC)
|
/* Copyright (c) 2023-2024 Barcelona Supercomputing Center (BSC)
|
||||||
* SPDX-License-Identifier: GPL-3.0-or-later */
|
* SPDX-License-Identifier: GPL-3.0-or-later */
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
@ -18,7 +18,7 @@ main(void)
|
|||||||
int ntasks = 100;
|
int ntasks = 100;
|
||||||
uint32_t typeid = 1;
|
uint32_t typeid = 1;
|
||||||
|
|
||||||
instr_nanos6_type_create(typeid);
|
instr_nanos6_type_create((int32_t) typeid);
|
||||||
|
|
||||||
/* Create and run the tasks, one nested into another */
|
/* Create and run the tasks, one nested into another */
|
||||||
for (int32_t id = 1; id <= ntasks; id++) {
|
for (int32_t id = 1; id <= ntasks; id++) {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (c) 2021-2023 Barcelona Supercomputing Center (BSC)
|
/* Copyright (c) 2021-2024 Barcelona Supercomputing Center (BSC)
|
||||||
* SPDX-License-Identifier: GPL-3.0-or-later */
|
* SPDX-License-Identifier: GPL-3.0-or-later */
|
||||||
|
|
||||||
#ifndef INSTR_NANOS6_H
|
#ifndef INSTR_NANOS6_H
|
||||||
@ -20,7 +20,7 @@ instr_nanos6_type_create(int32_t typeid)
|
|||||||
struct ovni_ev ev = {0};
|
struct ovni_ev ev = {0};
|
||||||
|
|
||||||
ovni_ev_set_mcv(&ev, "6Yc");
|
ovni_ev_set_mcv(&ev, "6Yc");
|
||||||
ovni_ev_set_clock(&ev, get_clock());
|
ovni_ev_set_clock(&ev, (uint64_t) get_clock());
|
||||||
|
|
||||||
char buf[256];
|
char buf[256];
|
||||||
char *p = buf;
|
char *p = buf;
|
||||||
@ -32,7 +32,7 @@ instr_nanos6_type_create(int32_t typeid)
|
|||||||
sprintf(p, "testtype%d", typeid);
|
sprintf(p, "testtype%d", typeid);
|
||||||
nbytes += strlen(p) + 1;
|
nbytes += strlen(p) + 1;
|
||||||
|
|
||||||
ovni_ev_jumbo_emit(&ev, (uint8_t *) buf, nbytes);
|
ovni_ev_jumbo_emit(&ev, (uint8_t *) buf, (uint32_t) nbytes);
|
||||||
|
|
||||||
return task_get_type_gid(p);
|
return task_get_type_gid(p);
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (c) 2021-2023 Barcelona Supercomputing Center (BSC)
|
/* Copyright (c) 2021-2024 Barcelona Supercomputing Center (BSC)
|
||||||
* SPDX-License-Identifier: GPL-3.0-or-later */
|
* SPDX-License-Identifier: GPL-3.0-or-later */
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
@ -12,13 +12,13 @@ main(void)
|
|||||||
instr_nanos6_init();
|
instr_nanos6_init();
|
||||||
|
|
||||||
uint32_t typeid = 666;
|
uint32_t typeid = 666;
|
||||||
instr_nanos6_type_create(typeid);
|
instr_nanos6_type_create((int32_t) typeid);
|
||||||
|
|
||||||
uint32_t taskid = 1;
|
uint32_t taskid = 1;
|
||||||
instr_nanos6_task_create_and_execute(taskid, typeid);
|
instr_nanos6_task_create_and_execute((int32_t) taskid, typeid);
|
||||||
|
|
||||||
/* Run another nested task with same id (should fail) */
|
/* Run another nested task with same id (should fail) */
|
||||||
instr_nanos6_task_execute(taskid);
|
instr_nanos6_task_execute((int32_t) taskid);
|
||||||
|
|
||||||
instr_end();
|
instr_end();
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (c) 2021-2023 Barcelona Supercomputing Center (BSC)
|
/* Copyright (c) 2021-2024 Barcelona Supercomputing Center (BSC)
|
||||||
* SPDX-License-Identifier: GPL-3.0-or-later */
|
* SPDX-License-Identifier: GPL-3.0-or-later */
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
@ -15,7 +15,7 @@ main(void)
|
|||||||
int ntasks = 100;
|
int ntasks = 100;
|
||||||
uint32_t typeid = 1;
|
uint32_t typeid = 1;
|
||||||
|
|
||||||
instr_nanos6_type_create(typeid);
|
instr_nanos6_type_create((int32_t) typeid);
|
||||||
|
|
||||||
/* Create and run the tasks, one nested into another */
|
/* Create and run the tasks, one nested into another */
|
||||||
for (int i = 0; i < ntasks; i++) {
|
for (int i = 0; i < ntasks; i++) {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (c) 2023 Barcelona Supercomputing Center (BSC)
|
/* Copyright (c) 2023-2024 Barcelona Supercomputing Center (BSC)
|
||||||
* SPDX-License-Identifier: GPL-3.0-or-later */
|
* SPDX-License-Identifier: GPL-3.0-or-later */
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
@ -14,15 +14,15 @@ main(void)
|
|||||||
instr_nanos6_init();
|
instr_nanos6_init();
|
||||||
|
|
||||||
uint32_t typeid = 666;
|
uint32_t typeid = 666;
|
||||||
instr_nanos6_type_create(typeid);
|
instr_nanos6_type_create((int32_t) typeid);
|
||||||
|
|
||||||
uint32_t taskid = 1;
|
uint32_t taskid = 1;
|
||||||
instr_nanos6_task_create_and_execute(taskid, typeid);
|
instr_nanos6_task_create_and_execute((int32_t) taskid, typeid);
|
||||||
instr_nanos6_task_end(taskid);
|
instr_nanos6_task_end((int32_t) taskid);
|
||||||
|
|
||||||
/* Run again the same task (should fail) */
|
/* Run again the same task (should fail) */
|
||||||
instr_nanos6_task_execute(taskid);
|
instr_nanos6_task_execute((int32_t) taskid);
|
||||||
instr_nanos6_task_end(taskid);
|
instr_nanos6_task_end((int32_t) taskid);
|
||||||
|
|
||||||
instr_end();
|
instr_end();
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (c) 2021-2023 Barcelona Supercomputing Center (BSC)
|
/* Copyright (c) 2021-2024 Barcelona Supercomputing Center (BSC)
|
||||||
* SPDX-License-Identifier: GPL-3.0-or-later */
|
* SPDX-License-Identifier: GPL-3.0-or-later */
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
@ -19,7 +19,7 @@ main(void)
|
|||||||
instr_nanos6_init();
|
instr_nanos6_init();
|
||||||
|
|
||||||
uint32_t typeid = 100;
|
uint32_t typeid = 100;
|
||||||
uint32_t gid = instr_nanos6_type_create(typeid);
|
uint32_t gid = instr_nanos6_type_create((int32_t) typeid);
|
||||||
|
|
||||||
/* Create two tasks of the same type */
|
/* Create two tasks of the same type */
|
||||||
instr_nanos6_task_create(1, typeid);
|
instr_nanos6_task_create(1, typeid);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (c) 2021-2023 Barcelona Supercomputing Center (BSC)
|
/* Copyright (c) 2021-2024 Barcelona Supercomputing Center (BSC)
|
||||||
* SPDX-License-Identifier: GPL-3.0-or-later */
|
* SPDX-License-Identifier: GPL-3.0-or-later */
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@ -22,7 +22,7 @@ main(void)
|
|||||||
instr_nanos6_type_create(i + 1);
|
instr_nanos6_type_create(i + 1);
|
||||||
|
|
||||||
for (int i = 0; i < ntasks; i++) {
|
for (int i = 0; i < ntasks; i++) {
|
||||||
instr_nanos6_task_create_and_execute(i + 1, (i % ntypes) + 1);
|
instr_nanos6_task_create_and_execute(i + 1, (uint32_t) ((i % ntypes) + 1));
|
||||||
sleep_us(500);
|
sleep_us(500);
|
||||||
instr_nanos6_task_end(i + 1);
|
instr_nanos6_task_end(i + 1);
|
||||||
instr_nanos6_task_body_exit();
|
instr_nanos6_task_body_exit();
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (c) 2023 Barcelona Supercomputing Center (BSC)
|
/* Copyright (c) 2023-2024 Barcelona Supercomputing Center (BSC)
|
||||||
* SPDX-License-Identifier: GPL-3.0-or-later */
|
* SPDX-License-Identifier: GPL-3.0-or-later */
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
@ -17,7 +17,7 @@ main(void)
|
|||||||
|
|
||||||
uint32_t typeid = 100;
|
uint32_t typeid = 100;
|
||||||
|
|
||||||
instr_nosv_type_create(typeid);
|
instr_nosv_type_create((int32_t) typeid);
|
||||||
instr_nosv_task_create_par(1, typeid);
|
instr_nosv_task_create_par(1, typeid);
|
||||||
instr_nosv_task_create_par(2, typeid);
|
instr_nosv_task_create_par(2, typeid);
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ main(void)
|
|||||||
|
|
||||||
uint32_t typeid = 100;
|
uint32_t typeid = 100;
|
||||||
|
|
||||||
instr_nosv_type_create(typeid);
|
instr_nosv_type_create((int32_t) typeid);
|
||||||
instr_nosv_task_create(1, typeid);
|
instr_nosv_task_create(1, typeid);
|
||||||
instr_nosv_task_create(2, typeid);
|
instr_nosv_task_create(2, typeid);
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (c) 2023 Barcelona Supercomputing Center (BSC)
|
/* Copyright (c) 2023-2024 Barcelona Supercomputing Center (BSC)
|
||||||
* SPDX-License-Identifier: GPL-3.0-or-later */
|
* SPDX-License-Identifier: GPL-3.0-or-later */
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
@ -19,7 +19,7 @@ main(void)
|
|||||||
|
|
||||||
uint32_t typeid = 100;
|
uint32_t typeid = 100;
|
||||||
|
|
||||||
instr_nosv_type_create(typeid);
|
instr_nosv_type_create((int32_t) typeid);
|
||||||
instr_nosv_task_create_par(1, typeid);
|
instr_nosv_task_create_par(1, typeid);
|
||||||
instr_nosv_task_create_par(2, typeid);
|
instr_nosv_task_create_par(2, typeid);
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ main(void)
|
|||||||
instr_nosv_init();
|
instr_nosv_init();
|
||||||
|
|
||||||
uint32_t typeid = 666;
|
uint32_t typeid = 666;
|
||||||
instr_nosv_type_create(typeid);
|
instr_nosv_type_create((int32_t) typeid);
|
||||||
|
|
||||||
instr_nosv_task_create(1, typeid);
|
instr_nosv_task_create(1, typeid);
|
||||||
instr_nosv_task_execute(1, 0);
|
instr_nosv_task_execute(1, 0);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (c) 2023 Barcelona Supercomputing Center (BSC)
|
/* Copyright (c) 2023-2024 Barcelona Supercomputing Center (BSC)
|
||||||
* SPDX-License-Identifier: GPL-3.0-or-later */
|
* SPDX-License-Identifier: GPL-3.0-or-later */
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
@ -19,7 +19,7 @@ main(void)
|
|||||||
|
|
||||||
uint32_t typeid = 100;
|
uint32_t typeid = 100;
|
||||||
|
|
||||||
instr_nosv_type_create(typeid);
|
instr_nosv_type_create((int32_t) typeid);
|
||||||
instr_nosv_task_create_par(1, typeid);
|
instr_nosv_task_create_par(1, typeid);
|
||||||
instr_nosv_submit_enter();
|
instr_nosv_submit_enter();
|
||||||
instr_nosv_task_execute(1, 1);
|
instr_nosv_task_execute(1, 1);
|
||||||
|
@ -21,7 +21,7 @@ instr_nosv_type_create(int32_t typeid)
|
|||||||
struct ovni_ev ev = {0};
|
struct ovni_ev ev = {0};
|
||||||
|
|
||||||
ovni_ev_set_mcv(&ev, "VYc");
|
ovni_ev_set_mcv(&ev, "VYc");
|
||||||
ovni_ev_set_clock(&ev, get_clock());
|
ovni_ev_set_clock(&ev, (uint64_t) get_clock());
|
||||||
|
|
||||||
char buf[256];
|
char buf[256];
|
||||||
char *p = buf;
|
char *p = buf;
|
||||||
@ -33,7 +33,7 @@ instr_nosv_type_create(int32_t typeid)
|
|||||||
sprintf(p, "testtype%d", typeid);
|
sprintf(p, "testtype%d", typeid);
|
||||||
nbytes += strlen(p) + 1;
|
nbytes += strlen(p) + 1;
|
||||||
|
|
||||||
ovni_ev_jumbo_emit(&ev, (uint8_t *) buf, nbytes);
|
ovni_ev_jumbo_emit(&ev, (uint8_t *) buf, (uint32_t) nbytes);
|
||||||
|
|
||||||
return task_get_type_gid(p);
|
return task_get_type_gid(p);
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
#include "instr_nosv.h"
|
#include "instr_nosv.h"
|
||||||
|
|
||||||
static void
|
static void
|
||||||
task(int32_t id, uint32_t typeid, int us)
|
task(uint32_t id, uint32_t typeid, int us)
|
||||||
{
|
{
|
||||||
instr_nosv_task_create(id, typeid);
|
instr_nosv_task_create(id, typeid);
|
||||||
instr_nosv_task_execute(id, 0);
|
instr_nosv_task_execute(id, 0);
|
||||||
@ -23,11 +23,11 @@ main(void)
|
|||||||
instr_start(rank, nranks);
|
instr_start(rank, nranks);
|
||||||
instr_nosv_init();
|
instr_nosv_init();
|
||||||
|
|
||||||
instr_nosv_type_create(typeid);
|
instr_nosv_type_create((int32_t) typeid);
|
||||||
|
|
||||||
/* Create some fake nosv tasks */
|
/* Create some fake nosv tasks */
|
||||||
for (int i = 0; i < 10; i++)
|
for (int i = 0; i < 10; i++)
|
||||||
task(i + 1, typeid, 5000);
|
task((uint32_t) i + 1, typeid, 5000);
|
||||||
|
|
||||||
instr_end();
|
instr_end();
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ main(void)
|
|||||||
instr_thread_execute(lcpu, -1, 0);
|
instr_thread_execute(lcpu, -1, 0);
|
||||||
|
|
||||||
uint32_t typeid = 1;
|
uint32_t typeid = 1;
|
||||||
instr_nosv_type_create(typeid);
|
instr_nosv_type_create((int32_t) typeid);
|
||||||
instr_nosv_task_create(1, typeid);
|
instr_nosv_task_create(1, typeid);
|
||||||
instr_nosv_task_execute(1, 0);
|
instr_nosv_task_execute(1, 0);
|
||||||
sleep_us(10000);
|
sleep_us(10000);
|
||||||
|
@ -18,7 +18,7 @@ main(void)
|
|||||||
|
|
||||||
uint32_t typeid = 100;
|
uint32_t typeid = 100;
|
||||||
|
|
||||||
instr_nosv_type_create(typeid);
|
instr_nosv_type_create((int32_t) typeid);
|
||||||
instr_nosv_task_create(1, typeid);
|
instr_nosv_task_create(1, typeid);
|
||||||
instr_nosv_task_create_par(2, typeid);
|
instr_nosv_task_create_par(2, typeid);
|
||||||
|
|
||||||
|
@ -17,21 +17,21 @@ main(void)
|
|||||||
int ntasks = 100;
|
int ntasks = 100;
|
||||||
uint32_t typeid = 1;
|
uint32_t typeid = 1;
|
||||||
|
|
||||||
instr_nosv_type_create(typeid);
|
instr_nosv_type_create((int32_t) typeid);
|
||||||
|
|
||||||
for (int id = 1; id <= ntasks; id++)
|
for (int id = 1; id <= ntasks; id++)
|
||||||
instr_nosv_task_create(id, typeid);
|
instr_nosv_task_create((uint32_t) id, typeid);
|
||||||
|
|
||||||
for (int id = 1; id <= ntasks; id++) {
|
for (int id = 1; id <= ntasks; id++) {
|
||||||
instr_nosv_task_execute(id, 0);
|
instr_nosv_task_execute((uint32_t) id, 0);
|
||||||
instr_nosv_task_pause(id, 0);
|
instr_nosv_task_pause((uint32_t) id, 0);
|
||||||
instr_nosv_submit_enter();
|
instr_nosv_submit_enter();
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int id = ntasks; id >= 1; id--) {
|
for (int id = ntasks; id >= 1; id--) {
|
||||||
instr_nosv_submit_exit();
|
instr_nosv_submit_exit();
|
||||||
instr_nosv_task_resume(id, 0);
|
instr_nosv_task_resume((uint32_t) id, 0);
|
||||||
instr_nosv_task_end(id, 0);
|
instr_nosv_task_end((uint32_t) id, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
instr_end();
|
instr_end();
|
||||||
|
@ -17,7 +17,7 @@ main(void)
|
|||||||
uint32_t typeid = 100;
|
uint32_t typeid = 100;
|
||||||
uint32_t taskid = 200;
|
uint32_t taskid = 200;
|
||||||
|
|
||||||
instr_nosv_type_create(typeid);
|
instr_nosv_type_create((int32_t) typeid);
|
||||||
instr_nosv_task_create_par(taskid, typeid);
|
instr_nosv_task_create_par(taskid, typeid);
|
||||||
|
|
||||||
/* Create and run the tasks, one nested into another */
|
/* Create and run the tasks, one nested into another */
|
||||||
|
@ -18,7 +18,7 @@ main(void)
|
|||||||
int us = 500;
|
int us = 500;
|
||||||
uint32_t typeid = 1;
|
uint32_t typeid = 1;
|
||||||
|
|
||||||
instr_nosv_type_create(typeid);
|
instr_nosv_type_create((int32_t) typeid);
|
||||||
instr_nosv_task_create(1, typeid);
|
instr_nosv_task_create(1, typeid);
|
||||||
instr_nosv_task_execute(1, 0);
|
instr_nosv_task_execute(1, 0);
|
||||||
sleep_us(us);
|
sleep_us(us);
|
||||||
|
@ -19,7 +19,7 @@ main(void)
|
|||||||
instr_nosv_init();
|
instr_nosv_init();
|
||||||
|
|
||||||
uint32_t typeid = 100;
|
uint32_t typeid = 100;
|
||||||
uint32_t gid = instr_nosv_type_create(typeid);
|
uint32_t gid = instr_nosv_type_create((int32_t) typeid);
|
||||||
|
|
||||||
/* Create two tasks of the same type */
|
/* Create two tasks of the same type */
|
||||||
instr_nosv_task_create(1, typeid);
|
instr_nosv_task_create(1, typeid);
|
||||||
|
@ -30,7 +30,7 @@ main(void)
|
|||||||
die("fopen failed:");
|
die("fopen failed:");
|
||||||
|
|
||||||
uint32_t typeid = 100;
|
uint32_t typeid = 100;
|
||||||
instr_nosv_type_create(typeid);
|
instr_nosv_type_create((int32_t) typeid);
|
||||||
|
|
||||||
instr_nosv_task_create(1, typeid);
|
instr_nosv_task_create(1, typeid);
|
||||||
|
|
||||||
|
@ -19,13 +19,13 @@ main(void)
|
|||||||
int ntypes = 10;
|
int ntypes = 10;
|
||||||
|
|
||||||
for (int i = 0; i < ntypes; i++)
|
for (int i = 0; i < ntypes; i++)
|
||||||
instr_nosv_type_create(i + 1);
|
instr_nosv_type_create((int32_t) i + 1);
|
||||||
|
|
||||||
for (int i = 0; i < ntasks; i++) {
|
for (int i = 0; i < ntasks; i++) {
|
||||||
instr_nosv_task_create(i + 1, (i % ntypes) + 1);
|
instr_nosv_task_create((uint32_t) i + 1, (uint32_t) ((i % ntypes) + 1));
|
||||||
instr_nosv_task_execute(i + 1, 0);
|
instr_nosv_task_execute((uint32_t) i + 1, 0);
|
||||||
sleep_us(500);
|
sleep_us(500);
|
||||||
instr_nosv_task_end(i + 1, 0);
|
instr_nosv_task_end((uint32_t) i + 1, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
instr_end();
|
instr_end();
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (c) 2021-2023 Barcelona Supercomputing Center (BSC)
|
/* Copyright (c) 2021-2024 Barcelona Supercomputing Center (BSC)
|
||||||
* SPDX-License-Identifier: GPL-3.0-or-later */
|
* SPDX-License-Identifier: GPL-3.0-or-later */
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
@ -17,7 +17,7 @@ thread_execute_delayed(int32_t cpu, int32_t creator_tid, uint64_t tag)
|
|||||||
{
|
{
|
||||||
struct ovni_ev ev = {0};
|
struct ovni_ev ev = {0};
|
||||||
ovni_ev_set_mcv(&ev, "OHx");
|
ovni_ev_set_mcv(&ev, "OHx");
|
||||||
ovni_ev_set_clock(&ev, ovni_clock_now() + delta);
|
ovni_ev_set_clock(&ev, ovni_clock_now() + (uint64_t) delta);
|
||||||
ovni_payload_add(&ev, (uint8_t *) &cpu, sizeof(cpu));
|
ovni_payload_add(&ev, (uint8_t *) &cpu, sizeof(cpu));
|
||||||
ovni_payload_add(&ev, (uint8_t *) &creator_tid, sizeof(creator_tid));
|
ovni_payload_add(&ev, (uint8_t *) &creator_tid, sizeof(creator_tid));
|
||||||
ovni_payload_add(&ev, (uint8_t *) &tag, sizeof(tag));
|
ovni_payload_add(&ev, (uint8_t *) &tag, sizeof(tag));
|
||||||
@ -50,7 +50,7 @@ start_delayed(int rank, int nranks)
|
|||||||
dbg("thread %d has cpu %d (ncpus=%d)",
|
dbg("thread %d has cpu %d (ncpus=%d)",
|
||||||
get_tid(), curcpu, nranks);
|
get_tid(), curcpu, nranks);
|
||||||
|
|
||||||
delta = ((int64_t) rank) * 2LL * 3600LL * 1000LL * 1000LL * 1000LL;
|
delta = ((int64_t) rank) * (int64_t) (2LL * 3600LL * 1000LL * 1000LL * 1000LL);
|
||||||
thread_execute_delayed(curcpu, -1, 0);
|
thread_execute_delayed(curcpu, -1, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (c) 2021-2023 Barcelona Supercomputing Center (BSC)
|
/* Copyright (c) 2021-2024 Barcelona Supercomputing Center (BSC)
|
||||||
* SPDX-License-Identifier: GPL-3.0-or-later */
|
* SPDX-License-Identifier: GPL-3.0-or-later */
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
@ -11,7 +11,7 @@ emit(char *mcv, int64_t clock)
|
|||||||
{
|
{
|
||||||
struct ovni_ev ev = {0};
|
struct ovni_ev ev = {0};
|
||||||
ovni_ev_set_mcv(&ev, mcv);
|
ovni_ev_set_mcv(&ev, mcv);
|
||||||
ovni_ev_set_clock(&ev, clock);
|
ovni_ev_set_clock(&ev, (uint64_t) clock);
|
||||||
ovni_ev_emit(&ev);
|
ovni_ev_emit(&ev);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -23,7 +23,7 @@ main(void)
|
|||||||
/* Leave some room to prevent clashes */
|
/* Leave some room to prevent clashes */
|
||||||
sleep_us(100); /* 100000 us */
|
sleep_us(100); /* 100000 us */
|
||||||
|
|
||||||
int64_t t0 = ovni_clock_now();
|
int64_t t0 = (int64_t) ovni_clock_now();
|
||||||
|
|
||||||
emit("OU[", t0);
|
emit("OU[", t0);
|
||||||
|
|
||||||
@ -33,7 +33,7 @@ main(void)
|
|||||||
t += 33;
|
t += 33;
|
||||||
}
|
}
|
||||||
|
|
||||||
emit("OU]", ovni_clock_now());
|
emit("OU]", (int64_t) ovni_clock_now());
|
||||||
|
|
||||||
instr_end();
|
instr_end();
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ emit(uint8_t *buf, size_t size)
|
|||||||
struct ovni_ev ev = {0};
|
struct ovni_ev ev = {0};
|
||||||
ovni_ev_set_mcv(&ev, "OB.");
|
ovni_ev_set_mcv(&ev, "OB.");
|
||||||
ovni_ev_set_clock(&ev, ovni_clock_now());
|
ovni_ev_set_clock(&ev, ovni_clock_now());
|
||||||
ovni_ev_jumbo_emit(&ev, buf, size);
|
ovni_ev_jumbo_emit(&ev, buf, (uint32_t) size);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define NRUNS 50
|
#define NRUNS 50
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (c) 2021-2023 Barcelona Supercomputing Center (BSC)
|
/* Copyright (c) 2021-2024 Barcelona Supercomputing Center (BSC)
|
||||||
* SPDX-License-Identifier: GPL-3.0-or-later */
|
* SPDX-License-Identifier: GPL-3.0-or-later */
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
@ -13,7 +13,7 @@ emit(uint8_t *buf, size_t size)
|
|||||||
struct ovni_ev ev = {0};
|
struct ovni_ev ev = {0};
|
||||||
ovni_ev_set_mcv(&ev, "OB.");
|
ovni_ev_set_mcv(&ev, "OB.");
|
||||||
ovni_ev_set_clock(&ev, ovni_clock_now());
|
ovni_ev_set_clock(&ev, ovni_clock_now());
|
||||||
ovni_ev_jumbo_emit(&ev, buf, size);
|
ovni_ev_jumbo_emit(&ev, buf, (uint32_t) size);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Test that we can flush the stream when we are working with a different tmpdir
|
/* Test that we can flush the stream when we are working with a different tmpdir
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (c) 2021-2023 Barcelona Supercomputing Center (BSC)
|
/* Copyright (c) 2021-2024 Barcelona Supercomputing Center (BSC)
|
||||||
* SPDX-License-Identifier: GPL-3.0-or-later */
|
* SPDX-License-Identifier: GPL-3.0-or-later */
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
@ -13,7 +13,7 @@ emit(uint8_t *buf, size_t size)
|
|||||||
struct ovni_ev ev = {0};
|
struct ovni_ev ev = {0};
|
||||||
ovni_ev_set_mcv(&ev, "OB.");
|
ovni_ev_set_mcv(&ev, "OB.");
|
||||||
ovni_ev_set_clock(&ev, ovni_clock_now());
|
ovni_ev_set_clock(&ev, ovni_clock_now());
|
||||||
ovni_ev_jumbo_emit(&ev, buf, size);
|
ovni_ev_jumbo_emit(&ev, buf, (uint32_t) size);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -29,7 +29,7 @@ main(void)
|
|||||||
instr_start(rank, nranks);
|
instr_start(rank, nranks);
|
||||||
|
|
||||||
/* Deterministic rand() */
|
/* Deterministic rand() */
|
||||||
srand(100 + rank);
|
srand(100U + (unsigned) rank);
|
||||||
|
|
||||||
/* Test set without labels */
|
/* Test set without labels */
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (c) 2021-2023 Barcelona Supercomputing Center (BSC)
|
/* Copyright (c) 2021-2024 Barcelona Supercomputing Center (BSC)
|
||||||
* SPDX-License-Identifier: GPL-3.0-or-later */
|
* SPDX-License-Identifier: GPL-3.0-or-later */
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
@ -30,7 +30,7 @@ emit(char *mcv, int64_t clock)
|
|||||||
{
|
{
|
||||||
struct ovni_ev ev = {0};
|
struct ovni_ev ev = {0};
|
||||||
ovni_ev_set_mcv(&ev, mcv);
|
ovni_ev_set_mcv(&ev, mcv);
|
||||||
ovni_ev_set_clock(&ev, clock);
|
ovni_ev_set_clock(&ev, (uint64_t) clock);
|
||||||
ovni_ev_emit(&ev);
|
ovni_ev_emit(&ev);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -39,12 +39,12 @@ main(void)
|
|||||||
{
|
{
|
||||||
init();
|
init();
|
||||||
|
|
||||||
int64_t t0 = ovni_clock_now();
|
int64_t t0 = (int64_t) ovni_clock_now();
|
||||||
|
|
||||||
/* Leave some room to prevent clashes */
|
/* Leave some room to prevent clashes */
|
||||||
sleep_us(100000); /* 100000000 ns */
|
sleep_us(100000); /* 100000000 ns */
|
||||||
|
|
||||||
int64_t t1 = ovni_clock_now();
|
int64_t t1 = (int64_t) ovni_clock_now();
|
||||||
|
|
||||||
emit("OU[", t1);
|
emit("OU[", t1);
|
||||||
|
|
||||||
@ -64,7 +64,7 @@ main(void)
|
|||||||
t += 33;
|
t += 33;
|
||||||
}
|
}
|
||||||
|
|
||||||
emit("OU]", ovni_clock_now());
|
emit("OU]", (int64_t) ovni_clock_now());
|
||||||
|
|
||||||
ovni_flush();
|
ovni_flush();
|
||||||
ovni_proc_fini();
|
ovni_proc_fini();
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (c) 2023 Barcelona Supercomputing Center (BSC)
|
/* Copyright (c) 2023-2024 Barcelona Supercomputing Center (BSC)
|
||||||
* SPDX-License-Identifier: GPL-3.0-or-later */
|
* SPDX-License-Identifier: GPL-3.0-or-later */
|
||||||
|
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
@ -12,8 +12,8 @@ emit_jumbo(uint8_t *buf, size_t size, int64_t clock)
|
|||||||
{
|
{
|
||||||
struct ovni_ev ev = {0};
|
struct ovni_ev ev = {0};
|
||||||
ovni_ev_set_mcv(&ev, "OUj");
|
ovni_ev_set_mcv(&ev, "OUj");
|
||||||
ovni_ev_set_clock(&ev, clock);
|
ovni_ev_set_clock(&ev, (uint64_t) clock);
|
||||||
ovni_ev_jumbo_emit(&ev, buf, size);
|
ovni_ev_jumbo_emit(&ev, buf, (uint32_t) size);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -21,7 +21,7 @@ emit(char *mcv, int64_t clock)
|
|||||||
{
|
{
|
||||||
struct ovni_ev ev = {0};
|
struct ovni_ev ev = {0};
|
||||||
ovni_ev_set_mcv(&ev, mcv);
|
ovni_ev_set_mcv(&ev, mcv);
|
||||||
ovni_ev_set_clock(&ev, clock);
|
ovni_ev_set_clock(&ev, (uint64_t) clock);
|
||||||
ovni_ev_emit(&ev);
|
ovni_ev_emit(&ev);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -37,11 +37,11 @@ fill(long room)
|
|||||||
/* Skip the jumbo event header and payload size */
|
/* Skip the jumbo event header and payload size */
|
||||||
size_t header = ev_size + 4;
|
size_t header = ev_size + 4;
|
||||||
|
|
||||||
size_t payload_size = OVNI_MAX_EV_BUF - room - header;
|
size_t payload_size = (size_t) OVNI_MAX_EV_BUF - (size_t) room - header;
|
||||||
uint8_t *payload_buf = calloc(1, payload_size);
|
uint8_t *payload_buf = calloc(1, payload_size);
|
||||||
|
|
||||||
/* Fill the stream buffer */
|
/* Fill the stream buffer */
|
||||||
int64_t t = ovni_clock_now();
|
int64_t t = (int64_t) ovni_clock_now();
|
||||||
emit_jumbo(payload_buf, payload_size, t);
|
emit_jumbo(payload_buf, payload_size, t);
|
||||||
|
|
||||||
/* Leave some room to prevent clashes */
|
/* Leave some room to prevent clashes */
|
||||||
@ -70,9 +70,9 @@ test_flush_after_sort(void)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/* Skip the two flush events and leave room for OU[ */
|
/* Skip the two flush events and leave room for OU[ */
|
||||||
fill(3 * sizeof(struct ovni_ev_header));
|
fill(3 * (long) sizeof(struct ovni_ev_header));
|
||||||
|
|
||||||
int64_t t = ovni_clock_now();
|
int64_t t = (int64_t) ovni_clock_now();
|
||||||
|
|
||||||
/* Emit the opening of the sort region */
|
/* Emit the opening of the sort region */
|
||||||
emit("OU[", t++);
|
emit("OU[", t++);
|
||||||
@ -85,7 +85,7 @@ test_flush_after_sort(void)
|
|||||||
emit("KCI", t++ - 100);
|
emit("KCI", t++ - 100);
|
||||||
|
|
||||||
/* Finish the sort region */
|
/* Finish the sort region */
|
||||||
emit("OU]", ovni_clock_now());
|
emit("OU]", (int64_t) ovni_clock_now());
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -94,7 +94,7 @@ test_unsorted(void)
|
|||||||
/* Test unsorted events in the sorting region */
|
/* Test unsorted events in the sorting region */
|
||||||
|
|
||||||
sleep_us(100); /* Make room */
|
sleep_us(100); /* Make room */
|
||||||
int64_t t = ovni_clock_now();
|
int64_t t = (int64_t) ovni_clock_now();
|
||||||
emit("OU[", t);
|
emit("OU[", t);
|
||||||
emit("KCI", t + 2 - 100); /* out of order */
|
emit("KCI", t + 2 - 100); /* out of order */
|
||||||
emit("KCO", t + 1 - 100);
|
emit("KCO", t + 1 - 100);
|
||||||
@ -106,7 +106,7 @@ test_overlap(void)
|
|||||||
{
|
{
|
||||||
/* Test overlapping events among regions */
|
/* Test overlapping events among regions */
|
||||||
|
|
||||||
int64_t t = ovni_clock_now();
|
int64_t t = (int64_t) ovni_clock_now();
|
||||||
/* Round time next 1 microsecond to be easier to read */
|
/* Round time next 1 microsecond to be easier to read */
|
||||||
t += 1000 - (t % 1000);
|
t += 1000 - (t % 1000);
|
||||||
|
|
||||||
@ -127,8 +127,8 @@ test_overlap_flush(void)
|
|||||||
|
|
||||||
/* Skip the two flush events and leave room for OU[ */
|
/* Skip the two flush events and leave room for OU[ */
|
||||||
sleep_us(100);
|
sleep_us(100);
|
||||||
fill(5 * sizeof(struct ovni_ev_header));
|
fill(5 * (long) sizeof(struct ovni_ev_header));
|
||||||
int64_t t = ovni_clock_now();
|
int64_t t = (int64_t) ovni_clock_now();
|
||||||
|
|
||||||
/* Round time next 1 microsecond to be easier to read */
|
/* Round time next 1 microsecond to be easier to read */
|
||||||
t += 1000 - (t % 1000);
|
t += 1000 - (t % 1000);
|
||||||
@ -138,11 +138,11 @@ test_overlap_flush(void)
|
|||||||
emit("KCI", t + 11);
|
emit("KCI", t + 11);
|
||||||
emit("OU]", t + 21);
|
emit("OU]", t + 21);
|
||||||
/* We need realistic clock due to incoming flush */
|
/* We need realistic clock due to incoming flush */
|
||||||
emit("OU[", ovni_clock_now());
|
emit("OU[", (int64_t) ovni_clock_now());
|
||||||
/* Flush here */
|
/* Flush here */
|
||||||
emit("KCO", t + 12);
|
emit("KCO", t + 12);
|
||||||
emit("KCI", t + 13);
|
emit("KCI", t + 13);
|
||||||
emit("OU]", ovni_clock_now());
|
emit("OU]", (int64_t) ovni_clock_now());
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (c) 2021-2023 Barcelona Supercomputing Center (BSC)
|
/* Copyright (c) 2021-2024 Barcelona Supercomputing Center (BSC)
|
||||||
* SPDX-License-Identifier: GPL-3.0-or-later */
|
* SPDX-License-Identifier: GPL-3.0-or-later */
|
||||||
|
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
@ -12,8 +12,8 @@ emit_jumbo(uint8_t *buf, size_t size, int64_t clock)
|
|||||||
{
|
{
|
||||||
struct ovni_ev ev = {0};
|
struct ovni_ev ev = {0};
|
||||||
ovni_ev_set_mcv(&ev, "OUj");
|
ovni_ev_set_mcv(&ev, "OUj");
|
||||||
ovni_ev_set_clock(&ev, clock);
|
ovni_ev_set_clock(&ev, (uint64_t) clock);
|
||||||
ovni_ev_jumbo_emit(&ev, buf, size);
|
ovni_ev_jumbo_emit(&ev, buf, (uint32_t) size);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -21,7 +21,7 @@ emit(char *mcv, int64_t clock)
|
|||||||
{
|
{
|
||||||
struct ovni_ev ev = {0};
|
struct ovni_ev ev = {0};
|
||||||
ovni_ev_set_mcv(&ev, mcv);
|
ovni_ev_set_mcv(&ev, mcv);
|
||||||
ovni_ev_set_clock(&ev, clock);
|
ovni_ev_set_clock(&ev, (uint64_t) clock);
|
||||||
ovni_ev_emit(&ev);
|
ovni_ev_emit(&ev);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -36,7 +36,7 @@ main(void)
|
|||||||
/* Leave some room to prevent clashes */
|
/* Leave some room to prevent clashes */
|
||||||
sleep_us(100); /* 100000 us */
|
sleep_us(100); /* 100000 us */
|
||||||
|
|
||||||
int64_t t0 = ovni_clock_now();
|
int64_t t0 = (int64_t) ovni_clock_now();
|
||||||
|
|
||||||
emit("OU[", t0);
|
emit("OU[", t0);
|
||||||
|
|
||||||
@ -48,7 +48,7 @@ main(void)
|
|||||||
|
|
||||||
/* Also test jumbo events */
|
/* Also test jumbo events */
|
||||||
for (int i = 0; i < BUFSIZE; i++)
|
for (int i = 0; i < BUFSIZE; i++)
|
||||||
buf[i] = i & 0xff;
|
buf[i] = (uint8_t) (i & 0xff);
|
||||||
|
|
||||||
emit_jumbo(buf, BUFSIZE, t);
|
emit_jumbo(buf, BUFSIZE, t);
|
||||||
|
|
||||||
@ -56,7 +56,7 @@ main(void)
|
|||||||
while ((int64_t) ovni_clock_now() < t)
|
while ((int64_t) ovni_clock_now() < t)
|
||||||
sleep_us(10);
|
sleep_us(10);
|
||||||
|
|
||||||
emit("OU]", ovni_clock_now());
|
emit("OU]", (int64_t) ovni_clock_now());
|
||||||
|
|
||||||
instr_end();
|
instr_end();
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (c) 2021-2023 Barcelona Supercomputing Center (BSC)
|
/* Copyright (c) 2021-2024 Barcelona Supercomputing Center (BSC)
|
||||||
* SPDX-License-Identifier: GPL-3.0-or-later */
|
* SPDX-License-Identifier: GPL-3.0-or-later */
|
||||||
|
|
||||||
#include <nanos6.h>
|
#include <nanos6.h>
|
||||||
@ -31,7 +31,7 @@ do_task(int t)
|
|||||||
static void
|
static void
|
||||||
do_run(void)
|
do_run(void)
|
||||||
{
|
{
|
||||||
memset(handle, 0, ntasks * sizeof(void *));
|
memset(handle, 0, (size_t) ntasks * sizeof(void *));
|
||||||
atomic_store(&nhandles, 0);
|
atomic_store(&nhandles, 0);
|
||||||
|
|
||||||
for (int t = 0; t < ntasks; t++)
|
for (int t = 0; t < ntasks; t++)
|
||||||
@ -63,7 +63,7 @@ main(void)
|
|||||||
{
|
{
|
||||||
ncpus = get_ncpus();
|
ncpus = get_ncpus();
|
||||||
|
|
||||||
handle = calloc(ntasks, sizeof(void *));
|
handle = calloc((size_t) ntasks, sizeof(void *));
|
||||||
|
|
||||||
if (handle == NULL) {
|
if (handle == NULL) {
|
||||||
perror("calloc failed");
|
perror("calloc failed");
|
||||||
|
@ -93,7 +93,7 @@ static void
|
|||||||
reset(double *matrix)
|
reset(double *matrix)
|
||||||
{
|
{
|
||||||
/* Set all elements to zero */
|
/* Set all elements to zero */
|
||||||
memset(matrix, 0, rows * cols * sizeof(double));
|
memset(matrix, 0, (size_t) rows * (size_t) cols * sizeof(double));
|
||||||
|
|
||||||
/* Set the left side to 1.0 */
|
/* Set the left side to 1.0 */
|
||||||
for (long i = 0; i < rows; i++)
|
for (long i = 0; i < rows; i++)
|
||||||
@ -128,7 +128,9 @@ main(void)
|
|||||||
die("cannot read pagesize");
|
die("cannot read pagesize");
|
||||||
|
|
||||||
double *matrix;
|
double *matrix;
|
||||||
int err = posix_memalign((void **) &matrix, pagesize, rows * cols * sizeof(double));
|
int err = posix_memalign((void **) &matrix, (size_t) pagesize,
|
||||||
|
(size_t) rows * (size_t) cols * sizeof(double));
|
||||||
|
|
||||||
if (err || matrix == NULL)
|
if (err || matrix == NULL)
|
||||||
die("posix_memalign failed:");
|
die("posix_memalign failed:");
|
||||||
|
|
||||||
|
@ -5,12 +5,16 @@ int main(void)
|
|||||||
#pragma omp parallel
|
#pragma omp parallel
|
||||||
#pragma omp single
|
#pragma omp single
|
||||||
{
|
{
|
||||||
|
/* Broken clang: https://github.com/llvm/llvm-project/issues/100536 */
|
||||||
|
#pragma clang diagnostic push
|
||||||
|
#pragma clang diagnostic ignored "-Wconversion"
|
||||||
#pragma omp taskloop
|
#pragma omp taskloop
|
||||||
for (int i = 0; i < 10000; i++)
|
for (int i = 0; i < 10000; i++)
|
||||||
{
|
{
|
||||||
#pragma omp task
|
#pragma omp task
|
||||||
sleep_us(1);
|
sleep_us(1);
|
||||||
}
|
}
|
||||||
|
#pragma clang diagnostic pop
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -30,8 +30,8 @@ cmp_int64(const void *a, const void *b)
|
|||||||
static void
|
static void
|
||||||
test_case(int64_t n, int64_t run)
|
test_case(int64_t n, int64_t run)
|
||||||
{
|
{
|
||||||
srand(run);
|
srand((unsigned) run);
|
||||||
int64_t *arr = calloc(n, sizeof(int64_t));
|
int64_t *arr = calloc((size_t) n, sizeof(int64_t));
|
||||||
|
|
||||||
if (arr == NULL)
|
if (arr == NULL)
|
||||||
die("calloc failed:");
|
die("calloc failed:");
|
||||||
@ -39,14 +39,14 @@ test_case(int64_t n, int64_t run)
|
|||||||
for (int64_t i = 0; i < n; i++)
|
for (int64_t i = 0; i < n; i++)
|
||||||
arr[i] = randint();
|
arr[i] = randint();
|
||||||
|
|
||||||
qsort(arr, n, sizeof(int64_t), cmp_int64);
|
qsort(arr, (size_t) n, sizeof(int64_t), cmp_int64);
|
||||||
|
|
||||||
int64_t *copy = calloc(n, sizeof(int64_t));
|
int64_t *copy = calloc((size_t) n, sizeof(int64_t));
|
||||||
|
|
||||||
if (copy == NULL)
|
if (copy == NULL)
|
||||||
die("calloc failed:");
|
die("calloc failed:");
|
||||||
|
|
||||||
memcpy(copy, arr, n * sizeof(int64_t));
|
memcpy(copy, arr, (size_t) n * sizeof(int64_t));
|
||||||
|
|
||||||
int64_t iold = rand() % n;
|
int64_t iold = rand() % n;
|
||||||
int64_t old = arr[iold];
|
int64_t old = arr[iold];
|
||||||
@ -68,7 +68,7 @@ test_case(int64_t n, int64_t run)
|
|||||||
sort_replace(arr, n, old, new);
|
sort_replace(arr, n, old, new);
|
||||||
|
|
||||||
copy[iold] = new;
|
copy[iold] = new;
|
||||||
qsort(copy, n, sizeof(int64_t), cmp_int64);
|
qsort(copy, (size_t) n, sizeof(int64_t), cmp_int64);
|
||||||
|
|
||||||
dbg("Contents after sort: ");
|
dbg("Contents after sort: ");
|
||||||
for (int64_t i = 0; i < n; i++) {
|
for (int64_t i = 0; i < n; i++) {
|
||||||
@ -76,7 +76,7 @@ test_case(int64_t n, int64_t run)
|
|||||||
i, arr[i], copy[i]);
|
i, arr[i], copy[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (memcmp(arr, copy, n * sizeof(int64_t)) == 0)
|
if (memcmp(arr, copy, (size_t) n * sizeof(int64_t)) == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
die("mismatch");
|
die("mismatch");
|
||||||
|
Loading…
Reference in New Issue
Block a user