working
This commit is contained in:
60
HW7/.idea/workspace.xml
generated
60
HW7/.idea/workspace.xml
generated
@@ -35,7 +35,12 @@
|
|||||||
</configurations>
|
</configurations>
|
||||||
</component>
|
</component>
|
||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="2c8533ba-540f-4e3f-9945-3ca06f59f247" name="Default Changelist" comment="" />
|
<list default="true" id="2c8533ba-540f-4e3f-9945-3ca06f59f247" name="Default Changelist" comment="">
|
||||||
|
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/main.dir/depend.make" beforeDir="false" afterPath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/main.dir/depend.make" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/cmake-build-debug/main" beforeDir="false" afterPath="$PROJECT_DIR$/cmake-build-debug/main" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/main.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/main.cpp" afterDir="false" />
|
||||||
|
</list>
|
||||||
<option name="SHOW_DIALOG" value="false" />
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||||
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
||||||
@@ -49,6 +54,7 @@
|
|||||||
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$/.." />
|
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$/.." />
|
||||||
</component>
|
</component>
|
||||||
<component name="ProjectId" id="1ZEInRSNTkqGaSVWBoFQVl9l6Ej" />
|
<component name="ProjectId" id="1ZEInRSNTkqGaSVWBoFQVl9l6Ej" />
|
||||||
|
<component name="ProjectLevelVcsManager" settingsEditedManually="true" />
|
||||||
<component name="ProjectViewState">
|
<component name="ProjectViewState">
|
||||||
<option name="hideEmptyMiddlePackages" value="true" />
|
<option name="hideEmptyMiddlePackages" value="true" />
|
||||||
<option name="showExcludedFiles" value="true" />
|
<option name="showExcludedFiles" value="true" />
|
||||||
@@ -64,7 +70,8 @@
|
|||||||
<property name="node.js.path.for.package.tslint" value="project" />
|
<property name="node.js.path.for.package.tslint" value="project" />
|
||||||
<property name="node.js.selected.package.eslint" value="(autodetect)" />
|
<property name="node.js.selected.package.eslint" value="(autodetect)" />
|
||||||
<property name="node.js.selected.package.tslint" value="(autodetect)" />
|
<property name="node.js.selected.package.tslint" value="(autodetect)" />
|
||||||
<property name="settings.editor.selected.configurable" value="configurable.group.build" />
|
<property name="run.code.analysis.last.selected.profile" value="pProject Default" />
|
||||||
|
<property name="settings.editor.selected.configurable" value="preferences.pluginManager" />
|
||||||
</component>
|
</component>
|
||||||
<component name="RunManager">
|
<component name="RunManager">
|
||||||
<configuration name="main" type="CMakeRunConfiguration" factoryName="Application" PASS_PARENT_ENVS_2="true" PROJECT_NAME="HW7" TARGET_NAME="main" CONFIG_NAME="Debug" RUN_TARGET_PROJECT_NAME="HW7" RUN_TARGET_NAME="main">
|
<configuration name="main" type="CMakeRunConfiguration" factoryName="Application" PASS_PARENT_ENVS_2="true" PROJECT_NAME="HW7" TARGET_NAME="main" CONFIG_NAME="Debug" RUN_TARGET_PROJECT_NAME="HW7" RUN_TARGET_NAME="main">
|
||||||
@@ -85,6 +92,7 @@
|
|||||||
<updated>1584397992559</updated>
|
<updated>1584397992559</updated>
|
||||||
<workItem from="1584397996277" duration="646000" />
|
<workItem from="1584397996277" duration="646000" />
|
||||||
<workItem from="1584399419332" duration="1165000" />
|
<workItem from="1584399419332" duration="1165000" />
|
||||||
|
<workItem from="1584410030817" duration="3105000" />
|
||||||
</task>
|
</task>
|
||||||
<servers />
|
<servers />
|
||||||
</component>
|
</component>
|
||||||
@@ -96,9 +104,55 @@
|
|||||||
<screen x="0" y="0" width="1920" height="1080" />
|
<screen x="0" y="0" width="1920" height="1080" />
|
||||||
</state>
|
</state>
|
||||||
<state x="648" y="275" key="#com.intellij.openapi.updateSettings.impl.PluginUpdateInfoDialog/0.0.1920.1080/-1920.135.1920.1080/1920.97.1920.1080@0.0.1920.1080" timestamp="1584399404367" />
|
<state x="648" y="275" key="#com.intellij.openapi.updateSettings.impl.PluginUpdateInfoDialog/0.0.1920.1080/-1920.135.1920.1080/1920.97.1920.1080@0.0.1920.1080" timestamp="1584399404367" />
|
||||||
<state x="653" y="368" key="com.intellij.ide.util.TipDialog" timestamp="1584399635101">
|
<state x="712" y="403" key="ANALYSIS_DLG_com.intellij.analysis.BaseAnalysisAction$1" timestamp="1584418407417">
|
||||||
<screen x="0" y="0" width="1920" height="1080" />
|
<screen x="0" y="0" width="1920" height="1080" />
|
||||||
</state>
|
</state>
|
||||||
|
<state x="712" y="403" key="ANALYSIS_DLG_com.intellij.analysis.BaseAnalysisAction$1/0.0.1920.1080/-1920.135.1920.1080/1920.97.1920.1080@0.0.1920.1080" timestamp="1584418407417" />
|
||||||
|
<state width="1878" height="357" key="GridCell.Tab.0.bottom" timestamp="1584417673541">
|
||||||
|
<screen x="0" y="0" width="1920" height="1080" />
|
||||||
|
</state>
|
||||||
|
<state width="1878" height="357" key="GridCell.Tab.0.bottom/0.0.1920.1080/-1920.135.1920.1080/1920.97.1920.1080@0.0.1920.1080" timestamp="1584417673541" />
|
||||||
|
<state width="1878" height="304" key="GridCell.Tab.0.bottom/0.0.1920.1080/-1920.158.1920.1057/1920.120.1920.1057@0.0.1920.1080" timestamp="1584410339079" />
|
||||||
|
<state width="1878" height="357" key="GridCell.Tab.0.center" timestamp="1584417673539">
|
||||||
|
<screen x="0" y="0" width="1920" height="1080" />
|
||||||
|
</state>
|
||||||
|
<state width="1878" height="357" key="GridCell.Tab.0.center/0.0.1920.1080/-1920.135.1920.1080/1920.97.1920.1080@0.0.1920.1080" timestamp="1584417673539" />
|
||||||
|
<state width="1878" height="304" key="GridCell.Tab.0.center/0.0.1920.1080/-1920.158.1920.1057/1920.120.1920.1057@0.0.1920.1080" timestamp="1584410339077" />
|
||||||
|
<state width="1878" height="357" key="GridCell.Tab.0.left" timestamp="1584417673539">
|
||||||
|
<screen x="0" y="0" width="1920" height="1080" />
|
||||||
|
</state>
|
||||||
|
<state width="1878" height="357" key="GridCell.Tab.0.left/0.0.1920.1080/-1920.135.1920.1080/1920.97.1920.1080@0.0.1920.1080" timestamp="1584417673539" />
|
||||||
|
<state width="1878" height="304" key="GridCell.Tab.0.left/0.0.1920.1080/-1920.158.1920.1057/1920.120.1920.1057@0.0.1920.1080" timestamp="1584410339076" />
|
||||||
|
<state width="1878" height="357" key="GridCell.Tab.0.right" timestamp="1584417673540">
|
||||||
|
<screen x="0" y="0" width="1920" height="1080" />
|
||||||
|
</state>
|
||||||
|
<state width="1878" height="357" key="GridCell.Tab.0.right/0.0.1920.1080/-1920.135.1920.1080/1920.97.1920.1080@0.0.1920.1080" timestamp="1584417673540" />
|
||||||
|
<state width="1878" height="304" key="GridCell.Tab.0.right/0.0.1920.1080/-1920.158.1920.1057/1920.120.1920.1057@0.0.1920.1080" timestamp="1584410339078" />
|
||||||
|
<state width="1878" height="357" key="GridCell.Tab.1.bottom" timestamp="1584417673544">
|
||||||
|
<screen x="0" y="0" width="1920" height="1080" />
|
||||||
|
</state>
|
||||||
|
<state width="1878" height="357" key="GridCell.Tab.1.bottom/0.0.1920.1080/-1920.135.1920.1080/1920.97.1920.1080@0.0.1920.1080" timestamp="1584417673544" />
|
||||||
|
<state width="1878" height="357" key="GridCell.Tab.1.center" timestamp="1584417673542">
|
||||||
|
<screen x="0" y="0" width="1920" height="1080" />
|
||||||
|
</state>
|
||||||
|
<state width="1878" height="357" key="GridCell.Tab.1.center/0.0.1920.1080/-1920.135.1920.1080/1920.97.1920.1080@0.0.1920.1080" timestamp="1584417673542" />
|
||||||
|
<state width="1878" height="357" key="GridCell.Tab.1.left" timestamp="1584417673542">
|
||||||
|
<screen x="0" y="0" width="1920" height="1080" />
|
||||||
|
</state>
|
||||||
|
<state width="1878" height="357" key="GridCell.Tab.1.left/0.0.1920.1080/-1920.135.1920.1080/1920.97.1920.1080@0.0.1920.1080" timestamp="1584417673542" />
|
||||||
|
<state width="1878" height="357" key="GridCell.Tab.1.right" timestamp="1584417673543">
|
||||||
|
<screen x="0" y="0" width="1920" height="1080" />
|
||||||
|
</state>
|
||||||
|
<state width="1878" height="357" key="GridCell.Tab.1.right/0.0.1920.1080/-1920.135.1920.1080/1920.97.1920.1080@0.0.1920.1080" timestamp="1584417673543" />
|
||||||
|
<state x="469" y="179" key="SettingsEditor" timestamp="1584418565619">
|
||||||
|
<screen x="0" y="0" width="1920" height="1080" />
|
||||||
|
</state>
|
||||||
|
<state x="469" y="179" key="SettingsEditor/0.0.1920.1080/-1920.135.1920.1080/1920.97.1920.1080@0.0.1920.1080" timestamp="1584418565619" />
|
||||||
|
<state x="469" y="179" key="SettingsEditor/0.0.1920.1080/-1920.158.1920.1057/1920.120.1920.1057@0.0.1920.1080" timestamp="1584418349102" />
|
||||||
|
<state x="653" y="368" key="com.intellij.ide.util.TipDialog" timestamp="1584418360381">
|
||||||
|
<screen x="0" y="0" width="1920" height="1080" />
|
||||||
|
</state>
|
||||||
|
<state x="653" y="368" key="com.intellij.ide.util.TipDialog/0.0.1920.1080/-1920.135.1920.1080/1920.97.1920.1080@0.0.1920.1080" timestamp="1584418360381" />
|
||||||
<state x="653" y="368" key="com.intellij.ide.util.TipDialog/0.0.1920.1080/-1920.158.1920.1057/1920.120.1920.1057@0.0.1920.1080" timestamp="1584399635101" />
|
<state x="653" y="368" key="com.intellij.ide.util.TipDialog/0.0.1920.1080/-1920.158.1920.1057/1920.120.1920.1057@0.0.1920.1080" timestamp="1584399635101" />
|
||||||
<state x="653" y="383" key="com.intellij.ide.util.TipDialog/0.23.1920.1057/-1920.158.1920.1057/1920.120.1920.1057@0.23.1920.1057" timestamp="1584399359149" />
|
<state x="653" y="383" key="com.intellij.ide.util.TipDialog/0.23.1920.1057/-1920.158.1920.1057/1920.120.1920.1057@0.23.1920.1057" timestamp="1584399359149" />
|
||||||
</component>
|
</component>
|
||||||
|
|||||||
36
HW7/cmake-build-debug/CMakeFiles/main.dir/CXX.includecache
Normal file
36
HW7/cmake-build-debug/CMakeFiles/main.dir/CXX.includecache
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
#IncludeRegexLine: ^[ ]*[#%][ ]*(include|import)[ ]*[<"]([^">]+)([">])
|
||||||
|
|
||||||
|
#IncludeRegexScan: ^.*$
|
||||||
|
|
||||||
|
#IncludeRegexComplain: ^$
|
||||||
|
|
||||||
|
#IncludeRegexTransform:
|
||||||
|
|
||||||
|
/Users/bradybodily/Repositories/CS5500_Parallel_Prog/HW7/main.cpp
|
||||||
|
iostream
|
||||||
|
-
|
||||||
|
mpi.h
|
||||||
|
-
|
||||||
|
stdlib.h
|
||||||
|
-
|
||||||
|
unistd.h
|
||||||
|
-
|
||||||
|
time.h
|
||||||
|
-
|
||||||
|
queue
|
||||||
|
-
|
||||||
|
|
||||||
|
/usr/local/Cellar/open-mpi/4.0.3/include/mpi.h
|
||||||
|
stddef.h
|
||||||
|
-
|
||||||
|
mpi_portable_platform.h
|
||||||
|
/usr/local/Cellar/open-mpi/4.0.3/include/mpi_portable_platform.h
|
||||||
|
openmpi/ompi/mpi/cxx/mpicxx.h
|
||||||
|
/usr/local/Cellar/open-mpi/4.0.3/include/openmpi/ompi/mpi/cxx/mpicxx.h
|
||||||
|
|
||||||
|
/usr/local/Cellar/open-mpi/4.0.3/include/mpi_portable_platform.h
|
||||||
|
omp.h
|
||||||
|
/usr/local/Cellar/open-mpi/4.0.3/include/omp.h
|
||||||
|
omp.h
|
||||||
|
/usr/local/Cellar/open-mpi/4.0.3/include/omp.h
|
||||||
|
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
# CMAKE generated file: DO NOT EDIT!
|
||||||
|
# Generated by "Unix Makefiles" Generator, CMake Version 3.15
|
||||||
|
|
||||||
|
CMakeFiles/main.dir/main.cpp.o
|
||||||
|
/Users/bradybodily/Repositories/CS5500_Parallel_Prog/HW7/main.cpp
|
||||||
|
/usr/local/Cellar/open-mpi/4.0.3/include/mpi.h
|
||||||
|
/usr/local/Cellar/open-mpi/4.0.3/include/mpi_portable_platform.h
|
||||||
@@ -1,2 +1,7 @@
|
|||||||
# Empty dependencies file for main.
|
# CMAKE generated file: DO NOT EDIT!
|
||||||
# This may be replaced when dependencies are built.
|
# Generated by "Unix Makefiles" Generator, CMake Version 3.15
|
||||||
|
|
||||||
|
CMakeFiles/main.dir/main.cpp.o: ../main.cpp
|
||||||
|
CMakeFiles/main.dir/main.cpp.o: /usr/local/Cellar/open-mpi/4.0.3/include/mpi.h
|
||||||
|
CMakeFiles/main.dir/main.cpp.o: /usr/local/Cellar/open-mpi/4.0.3/include/mpi_portable_platform.h
|
||||||
|
|
||||||
|
|||||||
BIN
HW7/cmake-build-debug/CMakeFiles/main.dir/main.cpp.o
Normal file
BIN
HW7/cmake-build-debug/CMakeFiles/main.dir/main.cpp.o
Normal file
Binary file not shown.
Binary file not shown.
80
HW7/main.cpp
80
HW7/main.cpp
@@ -1,18 +1,13 @@
|
|||||||
#include<iostream>
|
#include<iostream>
|
||||||
#include<mpi.h>
|
#include<mpi.h>
|
||||||
#include<stdlib.h>
|
#include<stdlib.h>
|
||||||
#include<unistd.h>
|
|
||||||
#include<time.h>
|
#include<time.h>
|
||||||
#include<queue>
|
#include<queue>
|
||||||
#define MCW MPI_COMM_WORLD
|
#define MCW MPI_COMM_WORLD
|
||||||
#define ANY MPI_ANY_SOURCE
|
#define GENERIC 0
|
||||||
#define IGNORE MPI_STATUS_IGNORE
|
#define SPECIAL 1
|
||||||
#define BLACK 0
|
|
||||||
#define WHITE 1
|
|
||||||
#define JOB 1
|
#define JOB 1
|
||||||
#define TOKEN 2
|
#define TOKEN 2
|
||||||
#define CREATED 3
|
|
||||||
#define COMPLETED 4
|
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
@@ -22,8 +17,8 @@ int main(int argc, char **argv) {
|
|||||||
int tasksCreated = 0;
|
int tasksCreated = 0;
|
||||||
int tasksCompleted = 0;
|
int tasksCompleted = 0;
|
||||||
int taskLimit;
|
int taskLimit;
|
||||||
int tokenColor = WHITE;
|
int tokenValue = SPECIAL;
|
||||||
int myColor = WHITE;
|
int myToken = SPECIAL;
|
||||||
int newTask;
|
int newTask;
|
||||||
bool hasToken = false;
|
bool hasToken = false;
|
||||||
queue<int> myTasks;
|
queue<int> myTasks;
|
||||||
@@ -44,18 +39,15 @@ int main(int argc, char **argv) {
|
|||||||
MPI_Send(&job, 1, MPI_INT, rand() % 4, JOB, MCW); //Send out the initial job
|
MPI_Send(&job, 1, MPI_INT, rand() % 4, JOB, MCW); //Send out the initial job
|
||||||
}
|
}
|
||||||
|
|
||||||
while(1) {
|
while(true) {
|
||||||
MPI_Probe(ANY,JOB,MCW,&status);
|
MPI_Iprobe(MPI_ANY_SOURCE, JOB, MCW, &jobFlag, &status); //Check to see if a job is available
|
||||||
MPI_Recv(&newTask,1,MPI_INT,ANY,JOB,MCW,&status);
|
if(jobFlag) {
|
||||||
|
MPI_Irecv(&newTask, 1, MPI_INT, MPI_ANY_SOURCE, JOB, MCW, &request);
|
||||||
myTasks.push(newTask);
|
myTasks.push(newTask);
|
||||||
//MPI_IProbe(ANY, JOB, MCW, &jobFlag, &status); //Check to see if a job is available
|
}
|
||||||
// if(jobFlag) {
|
|
||||||
// MPI_Irecv(&newTask, 1, MPI_INT, ANY, JOB, MCW, &request);
|
|
||||||
// myTasks.push(newTask);
|
|
||||||
// }
|
|
||||||
if(newTask == -1) { //If the stop signal is received, send my info to process 0 and break out of the loop
|
if(newTask == -1) { //If the stop signal is received, send my info to process 0 and break out of the loop
|
||||||
MPI_Send(&tasksCreated, 1, MPI_INT, 0, CREATED, MCW);
|
MPI_Send(&tasksCreated, 1, MPI_INT, 0, size-1, MCW);
|
||||||
MPI_Send(&tasksCompleted, 1, MPI_INT, 0, COMPLETED, MCW);
|
MPI_Send(&tasksCompleted, 1, MPI_INT, 0, size, MCW);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if(myTasks.size() > 16) { //If my task queue is greater than size 16, send off 2 tasks
|
if(myTasks.size() > 16) { //If my task queue is greater than size 16, send off 2 tasks
|
||||||
@@ -63,59 +55,67 @@ int main(int argc, char **argv) {
|
|||||||
int task = myTasks.front();
|
int task = myTasks.front();
|
||||||
myTasks.pop();
|
myTasks.pop();
|
||||||
int dest = rand() % 4;
|
int dest = rand() % 4;
|
||||||
while(dest == rank) {dest = rand() % 4;}
|
while(dest == rank) {dest = rand() % size;}
|
||||||
if(dest < rank) {myColor = BLACK;}
|
if(dest < rank) { myToken = GENERIC;}
|
||||||
MPI_Send(&task, 1, MPI_INT, dest, JOB, MCW);
|
MPI_Send(&task, 1, MPI_INT, dest, JOB, MCW);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!myTasks.empty()) { //Perform a task
|
if(!myTasks.empty()) {
|
||||||
int num = myTasks.front();
|
int num = myTasks.front();
|
||||||
myTasks.pop();
|
myTasks.pop();
|
||||||
sleep(static_cast<double>(num)/5);
|
num^3-num^4;
|
||||||
tasksCompleted++;
|
tasksCompleted++;
|
||||||
}
|
}
|
||||||
if(tasksCreated < taskLimit) { //Create more tasks
|
if(tasksCreated < taskLimit) {
|
||||||
for(int i = 0; i < rand() % 3 + 1; i++) {
|
for(int i = 0; i < rand() % size; i++) {
|
||||||
myTasks.push(rand() % 3 + 1);
|
myTasks.push(rand() % size);
|
||||||
tasksCreated++;
|
tasksCreated++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(myTasks.empty()) { //Check the token information
|
if(myTasks.empty()) { //Check the token information
|
||||||
if(hasToken) {
|
if(hasToken) {
|
||||||
cout<<"Rank: "<<rank<<", token: "<<(tokenColor==BLACK ? "Black" : "White")<<endl;
|
string tmp = "";
|
||||||
|
if(tokenValue == GENERIC)
|
||||||
|
tmp = "Generic";
|
||||||
|
else
|
||||||
|
tmp = "Special";
|
||||||
|
|
||||||
|
|
||||||
|
cout << "My Rank: " << rank << " My token: " << tmp << endl;
|
||||||
int dest = rank + 1 < size ? rank + 1 : 0;
|
int dest = rank + 1 < size ? rank + 1 : 0;
|
||||||
if(rank == 0) {tokenColor = WHITE;}
|
if(rank == 0) { tokenValue = SPECIAL;}
|
||||||
MPI_Send(&tokenColor, 1, MPI_INT, dest, TOKEN, MCW);
|
MPI_Send(&tokenValue, 1, MPI_INT, dest, TOKEN, MCW);
|
||||||
hasToken = false;
|
hasToken = false;
|
||||||
myColor = WHITE;
|
myToken = SPECIAL;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
int src = rank - 1 >= 0 ? rank - 1 : size - 1;
|
int src = rank - 1 >= 0 ? rank - 1 : size - 1;
|
||||||
MPI_Iprobe(src, TOKEN, MCW, &tokenFlag, &status);
|
MPI_Iprobe(src, TOKEN, MCW, &tokenFlag, &status);
|
||||||
if(tokenFlag) {
|
if(tokenFlag) {
|
||||||
MPI_Irecv(&tokenColor, 1, MPI_INT, src, TOKEN, MCW, &request);
|
MPI_Irecv(&tokenValue, 1, MPI_INT, src, TOKEN, MCW, &request);
|
||||||
hasToken = true;
|
hasToken = true;
|
||||||
if(rank == 0 && tokenColor == WHITE) {
|
if(rank == 0 && tokenValue == SPECIAL) {
|
||||||
int globalStop = -1;
|
int globalStop = -1;
|
||||||
for(int i = 1; i < size; i++) {
|
for(int i = 1; i < size; i++) {
|
||||||
MPI_Send(&globalStop, 1, MPI_INT, i, JOB, MCW);
|
MPI_Send(&globalStop, 1, MPI_INT, i, JOB, MCW);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if(myColor == BLACK) {
|
if(myToken == GENERIC) {
|
||||||
tokenColor = BLACK;
|
tokenValue = GENERIC;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//Print info after run.
|
||||||
if(rank == 0) { //Print out the task information
|
if(rank == 0) {
|
||||||
int created, completed;
|
int created;
|
||||||
|
int completed;
|
||||||
cout<<"Rank 0 created "<<tasksCreated<<" tasks and completed "<<tasksCompleted<<" tasks"<<endl;
|
cout<<"Rank 0 created "<<tasksCreated<<" tasks and completed "<<tasksCompleted<<" tasks"<<endl;
|
||||||
for(int i = 1; i < size; i++) {
|
for(int i = 0; i < size; i++) {
|
||||||
MPI_Recv(&created, 1, MPI_INT, i, CREATED, MCW, IGNORE);
|
MPI_Recv(&created, 1, MPI_INT, i, size -1, MCW, MPI_STATUS_IGNORE);
|
||||||
MPI_Recv(&completed, 1, MPI_INT, i, COMPLETED, MCW, IGNORE);
|
MPI_Recv(&completed, 1, MPI_INT, i, size, MCW, MPI_STATUS_IGNORE);
|
||||||
cout<<"Rank "<<i<<" created "<<created<<" tasks and completed "<<completed<<" tasks"<<endl;
|
cout<<"Rank "<<i<<" created "<<created<<" tasks and completed "<<completed<<" tasks"<<endl;
|
||||||
tasksCreated += created;
|
tasksCreated += created;
|
||||||
tasksCompleted += completed;
|
tasksCompleted += completed;
|
||||||
|
|||||||
Reference in New Issue
Block a user