Skip to content

Commit

Permalink
benchmark reads on device_matrix_data
Browse files Browse the repository at this point in the history
  • Loading branch information
upsj committed Jul 27, 2023
1 parent 49c4342 commit 9cdc64a
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 13 deletions.
11 changes: 6 additions & 5 deletions benchmark/conversion/conversion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using Generator = DefaultSystemGenerator<>;


struct ConversionBenchmark : Benchmark<gko::matrix_data<etype, itype>> {
struct ConversionBenchmark : Benchmark<gko::device_matrix_data<etype, itype>> {
std::string name;
std::vector<std::string> operations;

Expand Down Expand Up @@ -112,8 +112,8 @@ struct ConversionBenchmark : Benchmark<gko::matrix_data<etype, itype>> {
return Generator::describe_config(test_case);
}

gko::matrix_data<etype, itype> setup(std::shared_ptr<gko::Executor> exec,
json& test_case) const override
gko::device_matrix_data<etype, itype> setup(
std::shared_ptr<gko::Executor> exec, json& test_case) const override
{
gko::matrix_data<etype, itype> data;
data = Generator::generate_matrix_data(test_case);
Expand All @@ -122,12 +122,13 @@ struct ConversionBenchmark : Benchmark<gko::matrix_data<etype, itype>> {
test_case["rows"] = data.size[0];
test_case["cols"] = data.size[1];
test_case["nonzeros"] = data.nonzeros.size();
return data;
return gko::device_matrix_data<etype, itype>::create_from_host(exec,
data);
}


void run(std::shared_ptr<gko::Executor> exec, std::shared_ptr<Timer> timer,
gko::matrix_data<etype, itype>& data,
gko::device_matrix_data<etype, itype>& data,
const std::string& operation_name,
json& operation_case) const override
{
Expand Down
46 changes: 38 additions & 8 deletions benchmark/test/reference/conversion.profile.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,29 @@ The random seed for right hand sides is 42
The formats are coo,csr
Running test case stencil(100,7pt)
Matrix is of size (125, 125), 725
DEBUG: begin allocate
DEBUG: end allocate
DEBUG: begin allocate
DEBUG: end allocate
DEBUG: begin allocate
DEBUG: end allocate
DEBUG: begin components::aos_to_soa
DEBUG: end components::aos_to_soa
DEBUG: begin stencil(100,7pt)
Running conversion: coo-read
DEBUG: begin coo-read
DEBUG: begin allocate
DEBUG: end allocate
DEBUG: begin copy
DEBUG: end copy
DEBUG: begin allocate
DEBUG: end allocate
DEBUG: begin copy
DEBUG: end copy
DEBUG: begin allocate
DEBUG: end allocate
DEBUG: begin components::aos_to_soa
DEBUG: end components::aos_to_soa
DEBUG: begin copy
DEBUG: end copy
DEBUG: begin free
DEBUG: end free
DEBUG: begin free
Expand All @@ -28,12 +40,16 @@ DEBUG: end coo-read
DEBUG: begin coo-csr
DEBUG: begin allocate
DEBUG: end allocate
DEBUG: begin copy
DEBUG: end copy
DEBUG: begin allocate
DEBUG: end allocate
DEBUG: begin copy
DEBUG: end copy
DEBUG: begin allocate
DEBUG: end allocate
DEBUG: begin components::aos_to_soa
DEBUG: end components::aos_to_soa
DEBUG: begin copy
DEBUG: end copy
DEBUG: begin allocate
DEBUG: end allocate
DEBUG: begin components::fill_array
Expand Down Expand Up @@ -75,12 +91,16 @@ DEBUG: begin components::fill_array
DEBUG: end components::fill_array
DEBUG: begin allocate
DEBUG: end allocate
DEBUG: begin copy
DEBUG: end copy
DEBUG: begin allocate
DEBUG: end allocate
DEBUG: begin copy
DEBUG: end copy
DEBUG: begin allocate
DEBUG: end allocate
DEBUG: begin components::aos_to_soa
DEBUG: end components::aos_to_soa
DEBUG: begin copy
DEBUG: end copy
DEBUG: begin allocate
DEBUG: end allocate
DEBUG: begin free
Expand All @@ -104,12 +124,16 @@ DEBUG: begin components::fill_array
DEBUG: end components::fill_array
DEBUG: begin allocate
DEBUG: end allocate
DEBUG: begin copy
DEBUG: end copy
DEBUG: begin allocate
DEBUG: end allocate
DEBUG: begin copy
DEBUG: end copy
DEBUG: begin allocate
DEBUG: end allocate
DEBUG: begin components::aos_to_soa
DEBUG: end components::aos_to_soa
DEBUG: begin copy
DEBUG: end copy
DEBUG: begin allocate
DEBUG: end allocate
DEBUG: begin free
Expand Down Expand Up @@ -146,3 +170,9 @@ DEBUG: begin free
DEBUG: end free
DEBUG: end csr-coo
DEBUG: end stencil(100,7pt)
DEBUG: begin free
DEBUG: end free
DEBUG: begin free
DEBUG: end free
DEBUG: begin free
DEBUG: end free

0 comments on commit 9cdc64a

Please sign in to comment.