Windolyn/Operating-Systems
Folders and files
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Repository files navigation
Team Members----------------
Gwendolyn Khou gmk220003
Sara Ye xxy210000
----------------------------
INSTRUCTIONS FOR RUNNING PROGRAM
run in terminal
for general running, this will run with input size 5 workers 3, so if you want more, then run below
make
make run
for specififying input and workers, run in terminal
make
make run n=(replace with a number) m=(replace with a number) input=input.txt output=output.dat
-------------------------------------------------
gcc my-sum.cpp -o my-sum -lm
./my-sum n m input.dat output.dat
-------------------------------------------------
put n > m and > 0 in place of n and m
---------------------------
More details ( can skip)
TO RUN IN SCHOOL SERVER
ssh netid@cs1.utdallas.edu
then enter password...
nano my-sum.cpp
then paste in code from vscode
make sure their is an input file as well! input.dat is what was given
then in terminal, to run program, run
-------------------------------------------------
gcc my-sum.cpp -o my-sum -lm
./my-sum n m input.dat output.dat
-------------------------------------------------
for the command above, make sure that you replace n and m with numbers.
n is for the number in your input file
m is for the number of worker
and n >= m
also, make sure that the input.dat matches the name of the input file that you have.
baam : output data should run
------------------------------------------------------------------------------------------------------------------
to check program
this will print out first 10 of both files
paste <(head -n 10 input.txt | tr ' ' '\n') <(head -n 10 output.dat) | awk '{print "Input:", $1, "Output:", $2}'
given input.txt not input.dat, if you want to run on input.dat just change input.txt to input.dat
paste this in termial to check if sumof entire input file == to last in output file, in the command, it says second to last because technically last is just newline
input_sum=$(awk '{for(i=1;i<=NF;i++) sum+=$i} END{print sum}' input.txt)
echo "Input sum: $input_sum"
output_last=$(tail -n 2 output.dat | head -n 1)
echo "Last output: $output_last"