Skip to content

Commit

Permalink
Merge pull request #274 from agency-library/0.1.0
Browse files Browse the repository at this point in the history
0.1.0
  • Loading branch information
jaredhoberock authored Aug 19, 2016
2 parents e3ac819 + f3259b9 commit 7f3b799
Show file tree
Hide file tree
Showing 11 changed files with 764 additions and 51 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ int main()
}
~~~~

-----------


This code example implements a vector sum operation and executes it sequentially, in parallel, in parallel on a single GPU, and finally multiple GPUs:

~~~~{.cpp}
Expand Down Expand Up @@ -86,6 +89,7 @@ int main()
float* y_ptr = y.data();
float* z_ptr = z.data();
// execute sequentially in the current thread
bulk_invoke(seq(n), [=](sequenced_agent& self)
{
Expand All @@ -96,6 +100,7 @@ int main()
assert(z == reference);
std::fill(z.begin(), z.end(), 0);
// execute in parallel on the CPU
bulk_invoke(par(n), [=](parallel_agent& self)
{
Expand All @@ -106,6 +111,7 @@ int main()
assert(z == reference);
std::fill(z.begin(), z.end(), 0);
// execute in parallel on a GPU
cuda::grid_executor gpu;
bulk_invoke(par(n).on(gpu), [=] __device__ (parallel_agent& self)
Expand All @@ -116,6 +122,7 @@ int main()
assert(z == reference);
std::fill(z.begin(), z.end(), 0);
// execute in parallel on all GPUs in the system
cuda::multidevice_executor all_gpus;
Expand All @@ -128,6 +135,7 @@ int main()
assert(z == reference);
std::fill(z.begin(), z.end(), 0);
std::cout << "OK" << std::endl;
return 0;
}
Expand Down
34 changes: 18 additions & 16 deletions agency/bulk_async.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,22 +77,24 @@ struct enable_if_bulk_async_execution_policy
///
/// Messages from the agents in the two asynchronous tasks are printed while the main thread sleeps:
///
/// $ clang -std=c++11 -I. -lstdc++ -pthread examples/hello_async.cpp -o hello_async
/// $ ./hello_async
/// Starting two tasks asynchronously...
/// Sleeping before waiting on the tasks...
/// Hello, world from agent 0 in task 1
/// Hello, world from agent 1 in task 1
/// Hello, world from agent 2 in task 1
/// Hello, world from agent 3 in task 1
/// Hello, world from agent 4 in task 1
/// Hello, world from agent 0 in task 2
/// Hello, world from agent 1 in task 2
/// Hello, world from agent 2 in task 2
/// Hello, world from agent 3 in task 2
/// Hello, world from agent 4 in task 2
/// Woke up, waiting for the tasks to complete...
/// OK
/// ~~~~
/// $ clang -std=c++11 -I. -lstdc++ -pthread examples/hello_async.cpp -o hello_async
/// $ ./hello_async
/// Starting two tasks asynchronously...
/// Sleeping before waiting on the tasks...
/// Hello, world from agent 0 in task 1
/// Hello, world from agent 1 in task 1
/// Hello, world from agent 2 in task 1
/// Hello, world from agent 3 in task 1
/// Hello, world from agent 4 in task 1
/// Hello, world from agent 0 in task 2
/// Hello, world from agent 1 in task 2
/// Hello, world from agent 2 in task 2
/// Hello, world from agent 3 in task 2
/// Hello, world from agent 4 in task 2
/// Woke up, waiting for the tasks to complete...
/// OK
/// ~~~~
///
/// \see bulk_invoke
/// \see bulk_then
Expand Down
26 changes: 14 additions & 12 deletions agency/bulk_invoke.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,18 +101,20 @@ struct enable_if_bulk_invoke_execution_policy
///
/// Messages from agents 0 through 9 are printed in sequential order:
///
/// $ clang -std=c++11 -I. -lstdc++ -pthread examples/hello_lambda.cpp -o hello_lambda
/// $ ./hello_lambda
/// Hello, world from agent 0
/// Hello, world from agent 1
/// Hello, world from agent 2
/// Hello, world from agent 3
/// Hello, world from agent 4
/// Hello, world from agent 5
/// Hello, world from agent 6
/// Hello, world from agent 7
/// Hello, world from agent 8
/// Hello, world from agent 9
/// ~~~~
/// $ clang -std=c++11 -I. -lstdc++ -pthread examples/hello_lambda.cpp -o hello_lambda
/// $ ./hello_lambda
/// Hello, world from agent 0
/// Hello, world from agent 1
/// Hello, world from agent 2
/// Hello, world from agent 3
/// Hello, world from agent 4
/// Hello, world from agent 5
/// Hello, world from agent 6
/// Hello, world from agent 7
/// Hello, world from agent 8
/// Hello, world from agent 9
/// ~~~~
///
/// Changing the execution policy used in the call to `bulk_invoke` changes how and where the execution agents
/// will execute the provided function. This example demonstrates how to use `bulk_invoke` with `par` to execute
Expand Down
34 changes: 18 additions & 16 deletions agency/bulk_then.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,22 +83,24 @@ struct enable_if_bulk_then_execution_policy
///
/// Messages from agents in the predecessor task are guaranteed to be output before messages from the continuation:
///
/// $ clang -std=c++11 -I. -lstdc++ -pthread examples/hello_then.cpp -o hello_then
/// $ ./hello_then
/// Starting predecessor and continuation tasks asynchronously...
/// Sleeping before waiting on the continuation...
/// Hello, world from agent 0 in the predecessor task
/// Hello, world from agent 1 in the predecessor task
/// Hello, world from agent 2 in the predecessor task
/// Hello, world from agent 3 in the predecessor task
/// Hello, world from agent 4 in the predecessor task
/// Hello, world from agent 0 in the continuation
/// Hello, world from agent 1 in the continuation
/// Hello, world from agent 2 in the continuation
/// Hello, world from agent 3 in the continuation
/// Hello, world from agent 4 in the continuation
/// Woke up, waiting for the continuation to complete...
/// OK
/// ~~~~
/// $ clang -std=c++11 -I. -lstdc++ -pthread examples/hello_then.cpp -o hello_then
/// $ ./hello_then
/// Starting predecessor and continuation tasks asynchronously...
/// Sleeping before waiting on the continuation...
/// Hello, world from agent 0 in the predecessor task
/// Hello, world from agent 1 in the predecessor task
/// Hello, world from agent 2 in the predecessor task
/// Hello, world from agent 3 in the predecessor task
/// Hello, world from agent 4 in the predecessor task
/// Hello, world from agent 0 in the continuation
/// Hello, world from agent 1 in the continuation
/// Hello, world from agent 2 in the continuation
/// Hello, world from agent 3 in the continuation
/// Hello, world from agent 4 in the continuation
/// Woke up, waiting for the continuation to complete...
/// OK
/// ~~~~
///
/// \see bulk_invoke
/// \see bulk_async
Expand Down
9 changes: 4 additions & 5 deletions doc/Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -1036,7 +1036,7 @@ HTML_FILE_EXTENSION = .html
# of the possible markers and block names see the documentation.
# This tag requires that the tag GENERATE_HTML is set to YES.

HTML_HEADER =
HTML_HEADER = header.html

# The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each
# generated HTML page. If the tag is left blank doxygen will generate a standard
Expand All @@ -1046,7 +1046,7 @@ HTML_HEADER =
# that doxygen normally uses.
# This tag requires that the tag GENERATE_HTML is set to YES.

HTML_FOOTER =
HTML_FOOTER = footer.html

# The HTML_STYLESHEET tag can be used to specify a user-defined cascading style
# sheet that is used by each HTML page. It can be used to fine-tune the look of
Expand All @@ -1069,7 +1069,7 @@ HTML_STYLESHEET =
# see the documentation.
# This tag requires that the tag GENERATE_HTML is set to YES.

HTML_EXTRA_STYLESHEET =
HTML_EXTRA_STYLESHEET = customdoxygen.css

# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or
# other source files which should be copied to the HTML output directory. Note
Expand All @@ -1079,8 +1079,7 @@ HTML_EXTRA_STYLESHEET =
# files will be copied as-is; there are no commands or markers available.
# This tag requires that the tag GENERATE_HTML is set to YES.

HTML_EXTRA_FILES =
HTML_EXTRA_FILES =
HTML_EXTRA_FILES = doxy-boot.js

# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen
# will adjust the colors in the stylesheet and background images according to
Expand Down
6 changes: 4 additions & 2 deletions doc/DoxygenLayout.xml
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,10 @@

<!-- Layout definition for a file page -->
<file>
<briefdescription visible="yes"/>
<!-- Don't display the brief description at the top of the page -->
<briefdescription visible="no"/>
<!-- Move the detailed description to the top of the page, before member declarations -->
<detaileddescription title=""/>
<includes visible="$SHOW_INCLUDE_FILES"/>
<includegraph visible="$INCLUDE_GRAPH"/>
<includedbygraph visible="$INCLUDED_BY_GRAPH"/>
Expand All @@ -124,7 +127,6 @@
<variables title=""/>
<membergroups visible="yes"/>
</memberdecl>
<detaileddescription title=""/>
<memberdef>
<inlineclasses title=""/>
<defines title=""/>
Expand Down
Loading

0 comments on commit 7f3b799

Please sign in to comment.