Skip to content

Commit

Permalink
Merge pull request #18 from TrimVis/fix/integer-overflow
Browse files Browse the repository at this point in the history
LogGOPSim -V and Drawviz - Integer overflow fix
  • Loading branch information
tim0s authored Dec 5, 2023
2 parents d875e4f + 8860686 commit 76451de
Show file tree
Hide file tree
Showing 7 changed files with 118 additions and 78 deletions.
1 change: 0 additions & 1 deletion src/Drawviz/Drawviz.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,6 @@ int main(int argc, char **argv) {
maxtime -= args_info.starttime_arg;
TLViz.draw_everything(maxtime);
TLViz.close_graph();

}
else {
fprintf(stderr, "Unable to open file with starttimes (%s)\n", args_info.inputfile_arg);
Expand Down
2 changes: 1 addition & 1 deletion src/Drawviz/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
CXXFLAGS= -O0 -Wno-deprecated -Wall
CCFLAGS= -O0
LDFLAGS= -lps -lboost_regex-mt
LDFLAGS= -lps -lboost_regex

all:
gengetopt < drawviz.ggo
Expand Down
23 changes: 12 additions & 11 deletions src/Drawviz/TimelineDrawing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include <fstream>
#include <iostream>
#include <assert.h>
#include <inttypes.h>
#include <libps/pslib.h>

#include "TimelineDrawing.hpp"
Expand All @@ -38,7 +39,7 @@ void TimelineDrawing::init_graph(int numranks, int numcpus, int width = 800, int
PS_open_file(this->psdoc, filename.c_str());
PS_begin_page(this->psdoc, (this->numranks+2)*this->ranksep, (this->numranks+2)*this->ranksep);
this->psfont = PS_findfont(this->psdoc, "Helvetica", "", 0);
PS_setfont(psdoc, psfont, this->fontsize);
PS_setfont(this->psdoc, this->psfont, this->fontsize);

}

Expand Down Expand Up @@ -152,7 +153,7 @@ void TimelineDrawing::draw_seperator(int rank, int cpu, int pos) {
PS_stroke(psdoc);
}

void TimelineDrawing::draw_osend(int rank, int cpu, int start, int end, float r, float g, float b) {
void TimelineDrawing::draw_osend(int rank, int cpu, uint64_t start, uint64_t end, float r, float g, float b) {

PS_setcolor(psdoc, "stroke", "rgb", r, g, b, 0.0);
PS_setlinewidth(psdoc, args_info.linethickness_arg+1.0);
Expand Down Expand Up @@ -181,7 +182,7 @@ void TimelineDrawing::draw_osend(int rank, int cpu, int start, int end, float r,
}
}

void TimelineDrawing::draw_orecv(int rank, int cpu, int start, int end, float r, float g, float b) {
void TimelineDrawing::draw_orecv(int rank, int cpu, uint64_t start, uint64_t end, float r, float g, float b) {

PS_setcolor(psdoc, "stroke", "rgb", r, g, b, 0.0);
PS_setlinewidth(psdoc, args_info.linethickness_arg+1.0);
Expand Down Expand Up @@ -211,7 +212,7 @@ void TimelineDrawing::draw_orecv(int rank, int cpu, int start, int end, float r,

}

void TimelineDrawing::draw_loclop(int rank, int cpu, int start, int end, float r, float g, float b) {
void TimelineDrawing::draw_loclop(int rank, int cpu, uint64_t start, uint64_t end, float r, float g, float b) {

PS_setcolor(psdoc, "stroke", "rgb", r, g, b, 0.0);

Expand All @@ -238,7 +239,7 @@ void TimelineDrawing::draw_loclop(int rank, int cpu, int start, int end, float r

}

void TimelineDrawing::draw_noise(int rank, int cpu, int start, int end, float r, float g, float b) {
void TimelineDrawing::draw_noise(int rank, int cpu, uint64_t start, uint64_t end, float r, float g, float b) {

PS_setcolor(psdoc, "stroke", "rgb", r, g, b, 0.0);

Expand All @@ -264,7 +265,7 @@ void TimelineDrawing::draw_noise(int rank, int cpu, int start, int end, float r

}

void TimelineDrawing::draw_transmission(int source, int dest, int starttime, int endtime, int size, int G, float r, float g, float b) {
void TimelineDrawing::draw_transmission(int source, int dest, uint64_t starttime, uint64_t endtime, int size, int G, float r, float g, float b) {

PS_setcolor(psdoc, "stroke", "rgb", r, g, b, 0.0);
PS_setlinewidth(psdoc, args_info.linethickness_arg);
Expand Down Expand Up @@ -304,7 +305,7 @@ void TimelineDrawing::draw_transmission(int source, int dest, int starttime, int
}
}

void TimelineDrawing::add_osend(int rank, int start, int end, int cpu, float r, float g, float b) {
void TimelineDrawing::add_osend(int rank, uint64_t start, uint64_t end, int cpu, float r, float g, float b) {

overh os;
os.type = 1;
Expand All @@ -320,7 +321,7 @@ void TimelineDrawing::add_osend(int rank, int start, int end, int cpu, float r,

}

void TimelineDrawing::add_orecv(int rank, int start, int end, int cpu, float r, float g, float b) {
void TimelineDrawing::add_orecv(int rank, uint64_t start, uint64_t end, int cpu, float r, float g, float b) {

overh orecv;
orecv.type = 2;
Expand All @@ -336,7 +337,7 @@ void TimelineDrawing::add_orecv(int rank, int start, int end, int cpu, float r,

}

void TimelineDrawing::add_loclop(int rank, int start, int end, int cpu, float r, float g, float b) {
void TimelineDrawing::add_loclop(int rank, uint64_t start, uint64_t end, int cpu, float r, float g, float b) {

overh lop;
lop.type = 3;
Expand All @@ -352,7 +353,7 @@ void TimelineDrawing::add_loclop(int rank, int start, int end, int cpu, float r,

}

void TimelineDrawing::add_noise(int rank, int start, int end, int cpu, float r, float g, float b) {
void TimelineDrawing::add_noise(int rank, uint64_t start, uint64_t end, int cpu, float r, float g, float b) {

overh noise;
noise.type = 4;
Expand All @@ -368,7 +369,7 @@ void TimelineDrawing::add_noise(int rank, int start, int end, int cpu, float r,

}

void TimelineDrawing::add_transmission(int source, int dest, int starttime, int endtime, int size, int G, float r, float g, float b) {
void TimelineDrawing::add_transmission(int source, int dest, uint64_t starttime, uint64_t endtime, int size, int G, float r, float g, float b) {

trans tm;
tm.source = source;
Expand Down
29 changes: 15 additions & 14 deletions src/Drawviz/TimelineDrawing.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,16 @@
#include <assert.h>
#include <vector>
#include <libps/pslib.h>
#include <inttypes.h>
#include "cmdline.h"

class overh {
public:
int type; // 1 = osend, 2 = orecv
int rank;
int cpu;
int start;
int end;
uint64_t start;
uint64_t end;
float r;
float g;
float b;
Expand All @@ -32,8 +33,8 @@ class trans {
public:
int source;
int dest;
int starttime;
int endtime;
uint64_t starttime;
uint64_t endtime;
int size;
int G;
int r;
Expand Down Expand Up @@ -76,18 +77,18 @@ class TimelineDrawing {
void draw_everything(int maxtime);

void draw_ranklines();
void draw_osend(int rank, int cpu, int start, int end, float r, float g, float b);
void draw_orecv(int rank, int cpu, int start, int end, float r, float g, float b);
void draw_transmission(int source, int dest, int starttime, int endtime, int size, int G, float r, float g, float b);
void draw_loclop(int rank, int cpu, int start, int end, float r, float g, float b);
void draw_noise(int rank, int cpu, int start, int end, float r, float g, float b);
void draw_osend(int rank, int cpu, uint64_t start, uint64_t end, float r, float g, float b);
void draw_orecv(int rank, int cpu, uint64_t start, uint64_t end, float r, float g, float b);
void draw_transmission(int source, int dest, uint64_t starttime, uint64_t endtime, int size, int G, float r, float g, float b);
void draw_loclop(int rank, int cpu, uint64_t start, uint64_t end, float r, float g, float b);
void draw_noise(int rank, int cpu, uint64_t start, uint64_t end, float r, float g, float b);
void draw_seperator(int rank, int cpu, int pos);

void add_osend(int rank, int start, int end, int cpu, float r, float g, float b);
void add_orecv(int rank, int start, int end, int cpu, float r, float g, float b);
void add_transmission(int source, int dest, int starttime, int endtime, int size, int G, float r, float g, float b);
void add_loclop(int rank, int start, int end, int cpu, float r, float g, float b);
void add_noise(int rank, int start, int end, int cpu, float r, float g, float b);
void add_osend(int rank, uint64_t start, uint64_t end, int cpu, float r, float g, float b);
void add_orecv(int rank, uint64_t start, uint64_t end, int cpu, float r, float g, float b);
void add_transmission(int source, int dest, uint64_t starttime, uint64_t endtime, int size, int G, float r, float g, float b);
void add_loclop(int rank, uint64_t start, uint64_t end, int cpu, float r, float g, float b);
void add_noise(int rank, uint64_t start, uint64_t end, int cpu, float r, float g, float b);
};


Loading

0 comments on commit 76451de

Please sign in to comment.