first commit
This commit is contained in:
5
example/pachinco/.idea/codeStyles/codeStyleConfig.xml
generated
Normal file
5
example/pachinco/.idea/codeStyles/codeStyleConfig.xml
generated
Normal file
@@ -0,0 +1,5 @@
|
||||
<component name="ProjectCodeStyleConfiguration">
|
||||
<state>
|
||||
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Default (1)" />
|
||||
</state>
|
||||
</component>
|
||||
6
example/pachinco/.idea/misc.xml
generated
Normal file
6
example/pachinco/.idea/misc.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="JavaScriptSettings">
|
||||
<option name="languageLevel" value="ES6" />
|
||||
</component>
|
||||
</project>
|
||||
8
example/pachinco/.idea/modules.xml
generated
Normal file
8
example/pachinco/.idea/modules.xml
generated
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/pachinco.iml" filepath="$PROJECT_DIR$/.idea/pachinco.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
8
example/pachinco/.idea/pachinco.iml
generated
Normal file
8
example/pachinco/.idea/pachinco.iml
generated
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="CPP_MODULE" version="4">
|
||||
<component name="NewModuleRootManager">
|
||||
<content url="file://$MODULE_DIR$" />
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
||||
68
example/pachinco/.idea/workspace.xml
generated
Normal file
68
example/pachinco/.idea/workspace.xml
generated
Normal file
@@ -0,0 +1,68 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CMakeRunConfigurationManager" shouldGenerate="true" shouldDeleteObsolete="true">
|
||||
<generated />
|
||||
</component>
|
||||
<component name="CMakeSettings">
|
||||
<configurations>
|
||||
<configuration PROFILE_NAME="Debug" CONFIG_NAME="Debug" />
|
||||
</configurations>
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="1ec8baf7-c36e-415f-96a3-9219f74f3144" name="Default Changelist" comment="" />
|
||||
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
||||
<option name="LAST_RESOLUTION" value="IGNORE" />
|
||||
</component>
|
||||
<component name="MacroExpansionManager">
|
||||
<option name="directoryName" value="nlumVDio" />
|
||||
</component>
|
||||
<component name="ProjectId" id="1WPqoAEvmJQAG3ylPB23Icr232G" />
|
||||
<component name="PropertiesComponent">
|
||||
<property name="WebServerToolWindowFactoryState" value="false" />
|
||||
<property name="cf.advertisement.text.overridden" value="true" />
|
||||
<property name="last_opened_file_path" value="$PROJECT_DIR$" />
|
||||
<property name="node.js.detected.package.eslint" value="true" />
|
||||
<property name="node.js.detected.package.tslint" value="true" />
|
||||
<property name="node.js.path.for.package.eslint" 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.tslint" value="(autodetect)" />
|
||||
<property name="nodejs_package_manager_path" value="npm" />
|
||||
<property name="settings.editor.selected.configurable" value="preferences.pluginManager" />
|
||||
</component>
|
||||
<component name="RunDashboard">
|
||||
<option name="ruleStates">
|
||||
<list>
|
||||
<RuleState>
|
||||
<option name="name" value="ConfigurationTypeDashboardGroupingRule" />
|
||||
</RuleState>
|
||||
<RuleState>
|
||||
<option name="name" value="StatusDashboardGroupingRule" />
|
||||
</RuleState>
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="SvnConfiguration">
|
||||
<configuration />
|
||||
</component>
|
||||
<component name="TaskManager">
|
||||
<task active="true" id="Default" summary="Default task">
|
||||
<changelist id="1ec8baf7-c36e-415f-96a3-9219f74f3144" name="Default Changelist" comment="" />
|
||||
<created>1579061749869</created>
|
||||
<option name="number" value="Default" />
|
||||
<option name="presentableId" value="Default" />
|
||||
<updated>1579061749869</updated>
|
||||
<workItem from="1579061753840" duration="812000" />
|
||||
<workItem from="1579236356017" duration="351000" />
|
||||
<workItem from="1579842846262" duration="3379000" />
|
||||
<workItem from="1581113414207" duration="10085000" />
|
||||
</task>
|
||||
<servers />
|
||||
</component>
|
||||
<component name="TypeScriptGeneratedFilesManager">
|
||||
<option name="version" value="1" />
|
||||
</component>
|
||||
</project>
|
||||
BIN
example/pachinco/a.out
Executable file
BIN
example/pachinco/a.out
Executable file
Binary file not shown.
55
example/pachinco/pachinko.cpp
Normal file
55
example/pachinco/pachinko.cpp
Normal file
@@ -0,0 +1,55 @@
|
||||
|
||||
#include <iostream>
|
||||
#include <mpi.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <time>
|
||||
|
||||
//#include "/usr/local/include/mpi.h"
|
||||
#define MCW MPI_COMM_WORLD
|
||||
|
||||
using namespace std;
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
|
||||
int rank, size;
|
||||
int data;
|
||||
int dest;
|
||||
MPI_Init(&argc, &argv);
|
||||
MPI_Comm_rank(MCW, &rank);
|
||||
MPI_Comm_size(MCW, &size);
|
||||
srand(rank);
|
||||
|
||||
if (rank == 0) {
|
||||
data = rand % 20;
|
||||
cout << "Timer is set to " << data << endl;
|
||||
}
|
||||
|
||||
while (1) {
|
||||
MPI_Recv(&data, 1, MPI_INT, MPI_ANY_SOURCE, 0, MCW, MPI_STATUS_IGNORE);
|
||||
dest = rank++;
|
||||
|
||||
if (!(rand() % 5)) {
|
||||
data = -1;
|
||||
for (int i = 0; i < size; ++i)
|
||||
MPI_Send(&data, 1, MPI_INT, i, 0, MCW);
|
||||
}
|
||||
|
||||
if (data != 0) {
|
||||
data--;
|
||||
} else {
|
||||
dest = rank - 1;
|
||||
if (dest < 0)
|
||||
dest = size - 1;
|
||||
}
|
||||
|
||||
MPI_Send(&data, 1, MPI_INT, dest, 0, MCW);
|
||||
|
||||
cout << "rank " << rank << " is done.\n";
|
||||
|
||||
MPI_Finalize();
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user