@@ -359,10 +359,9 @@ TYPED_TEST(GenericVectorCache, GenericCanInitWithSize)
359
359
{
360
360
using value_type = typename TestFixture::value_type;
361
361
362
- this ->cache .init (this ->ref , this ->default_global_size ,
363
- this ->default_local_size );
364
- // only initialize when knowning the type
365
- auto buffer = this ->cache .template get <value_type>(this ->comm );
362
+ auto buffer = this ->cache .template get <value_type>(
363
+ this ->ref , this ->comm , this ->default_global_size ,
364
+ this ->default_local_size );
366
365
367
366
ASSERT_NE (buffer, nullptr );
368
367
GKO_ASSERT_EQUAL_DIMENSIONS (buffer->get_size (), this ->default_global_size );
@@ -376,14 +375,16 @@ TYPED_TEST(GenericVectorCache, GenericCanInitWithSize)
376
375
TYPED_TEST (GenericVectorCache, SecondInitWithSameSizeIsNoOp)
377
376
{
378
377
using value_type = typename TestFixture::value_type;
379
- this ->cache .init ( this -> ref , this -> default_global_size ,
380
- this ->default_local_size );
381
- auto buffer = this -> cache . template get <value_type>( this ->comm );
378
+ auto buffer = this ->cache .template get <value_type>(
379
+ this -> ref , this -> comm , this ->default_global_size ,
380
+ this ->default_local_size );
382
381
auto array_ptr =
383
382
generic_accessor::get_workspace (this ->cache ).get_const_data ();
384
383
auto array_size = generic_accessor::get_workspace (this ->cache ).get_size ();
385
384
386
- auto second_buffer = this ->cache .template get <value_type>(this ->comm );
385
+ auto second_buffer = this ->cache .template get <value_type>(
386
+ this ->ref , this ->comm , this ->default_global_size ,
387
+ this ->default_local_size );
387
388
388
389
ASSERT_NE (second_buffer, nullptr );
389
390
GKO_ASSERT_EQUAL_DIMENSIONS (second_buffer->get_size (),
@@ -402,17 +403,17 @@ TYPED_TEST(GenericVectorCache, SecondInitWithSameSizeIsNoOp)
402
403
TYPED_TEST (GenericVectorCache, SecondInitWithTheSmallEqSizeIsNoOp)
403
404
{
404
405
using value_type = typename TestFixture::value_type;
405
- gko::dim<2 > second_local_size{ 1 , 1 } ;
406
- gko::dim<2 > second_global_size{ this ->num_ranks , 1 } ;
407
- this ->cache .init ( this -> ref , this -> default_global_size ,
408
- this ->default_local_size );
409
- auto buffer = this -> cache . template get <value_type>( this ->comm );
406
+ gko::dim<2 > second_local_size ( 1 , 1 ) ;
407
+ gko::dim<2 > second_global_size ( this ->num_ranks , 1 ) ;
408
+ auto buffer = this ->cache .template get <value_type>(
409
+ this -> ref , this -> comm , this ->default_global_size ,
410
+ this ->default_local_size );
410
411
auto array_ptr =
411
412
generic_accessor::get_workspace (this ->cache ).get_const_data ();
412
413
auto array_size = generic_accessor::get_workspace (this ->cache ).get_size ();
413
414
414
- this ->cache .init ( this -> ref , second_global_size, second_local_size);
415
- auto second_buffer = this ->cache . template get <value_type>( this ->comm );
415
+ auto second_buffer = this ->cache .template get <value_type>(
416
+ this ->ref , this ->comm , second_global_size, second_local_size );
416
417
417
418
ASSERT_NE (second_buffer, nullptr );
418
419
GKO_ASSERT_EQUAL_DIMENSIONS (second_buffer->get_size (), second_global_size);
@@ -430,18 +431,18 @@ TYPED_TEST(GenericVectorCache, SecondInitWithTheSmallEqSizeIsNoOp)
430
431
TYPED_TEST (GenericVectorCache, SecondInitWithTheLargerSizeRecreate)
431
432
{
432
433
using value_type = typename TestFixture::value_type;
433
- gko::dim<2 > second_local_size{ this ->rank + 2 , 3 } ;
434
- gko::dim<2 > second_global_size{ this ->num_ranks * (this ->num_ranks + 3 ) / 2 ,
435
- 3 } ;
436
- this ->cache .init ( this -> ref , this -> default_global_size ,
437
- this ->default_local_size );
438
- auto buffer = this -> cache . template get <value_type>( this ->comm );
434
+ gko::dim<2 > second_local_size ( this ->rank + 2 , 3 ) ;
435
+ gko::dim<2 > second_global_size ( this ->num_ranks * (this ->num_ranks + 3 ) / 2 ,
436
+ 3 ) ;
437
+ auto buffer = this ->cache .template get <value_type>(
438
+ this -> ref , this -> comm , this ->default_global_size ,
439
+ this ->default_local_size );
439
440
auto array_ptr =
440
441
generic_accessor::get_workspace (this ->cache ).get_const_data ();
441
442
auto array_size = generic_accessor::get_workspace (this ->cache ).get_size ();
442
443
443
- this ->cache .init ( this -> ref , second_global_size, second_local_size);
444
- auto second_buffer = this ->cache . template get <value_type>( this ->comm );
444
+ auto second_buffer = this ->cache .template get <value_type>(
445
+ this ->ref , this ->comm , second_global_size, second_local_size );
445
446
446
447
ASSERT_NE (second_buffer, nullptr );
447
448
GKO_ASSERT_EQUAL_DIMENSIONS (second_buffer->get_size (), second_global_size);
@@ -460,14 +461,16 @@ TYPED_TEST(GenericVectorCache, GenericCanInitWithSizeAndType)
460
461
{
461
462
using value_type = typename TestFixture::value_type;
462
463
using another_type = gko::next_precision<value_type>;
463
- this ->cache .init ( this -> ref , this -> default_global_size ,
464
- this ->default_local_size );
465
- auto buffer = this -> cache . template get <value_type>( this ->comm );
464
+ auto buffer = this ->cache .template get <value_type>(
465
+ this -> ref , this -> comm , this ->default_global_size ,
466
+ this ->default_local_size );
466
467
auto array_ptr =
467
468
generic_accessor::get_workspace (this ->cache ).get_const_data ();
468
469
auto array_size = generic_accessor::get_workspace (this ->cache ).get_size ();
469
470
470
- auto second_buffer = this ->cache .template get <another_type>(this ->comm );
471
+ auto second_buffer = this ->cache .template get <another_type>(
472
+ this ->ref , this ->comm , this ->default_global_size ,
473
+ this ->default_local_size );
471
474
472
475
ASSERT_NE (second_buffer, nullptr );
473
476
GKO_ASSERT_EQUAL_DIMENSIONS (second_buffer->get_size (),
@@ -497,16 +500,16 @@ TYPED_TEST(GenericVectorCache, GenericCanInitWithDifferentExecutor)
497
500
{
498
501
using value_type = typename TestFixture::value_type;
499
502
auto another_ref = gko::ReferenceExecutor::create ();
500
- this ->cache .init ( this -> ref , this -> default_global_size ,
501
- this ->default_local_size );
502
- auto buffer = this -> cache . template get <value_type>( this ->comm );
503
+ auto buffer = this ->cache .template get <value_type>(
504
+ this -> ref , this -> comm , this ->default_global_size ,
505
+ this ->default_local_size );
503
506
auto array_ptr =
504
507
generic_accessor::get_workspace (this ->cache ).get_const_data ();
505
508
auto array_size = generic_accessor::get_workspace (this ->cache ).get_size ();
506
509
507
- this ->cache .init (another_ref, this -> default_global_size ,
508
- this ->default_local_size );
509
- auto second_buffer = this -> cache . template get <value_type>( this ->comm );
510
+ auto second_buffer = this ->cache .template get <value_type>(
511
+ another_ref, this -> comm , this ->default_global_size ,
512
+ this ->default_local_size );
510
513
511
514
ASSERT_NE (second_buffer, nullptr );
512
515
GKO_ASSERT_EQUAL_DIMENSIONS (second_buffer->get_size (),
@@ -524,9 +527,9 @@ TYPED_TEST(GenericVectorCache, GenericCanInitWithDifferentExecutor)
524
527
TYPED_TEST (GenericVectorCache, WorkspaceIsNotCopied)
525
528
{
526
529
using value_type = typename TestFixture::value_type;
527
- this ->cache .init ( this -> ref , this -> default_global_size ,
528
- this ->default_local_size );
529
- auto buffer = this -> cache . template get <value_type>( this ->comm );
530
+ auto buffer = this ->cache .template get <value_type>(
531
+ this -> ref , this -> comm , this ->default_global_size ,
532
+ this ->default_local_size );
530
533
531
534
gko::experimental::distributed::detail::GenericVectorCache cache (
532
535
this ->cache );
@@ -539,9 +542,9 @@ TYPED_TEST(GenericVectorCache, WorkspaceIsNotCopied)
539
542
TYPED_TEST (GenericVectorCache, WorkspaceIsNotMoved)
540
543
{
541
544
using value_type = typename TestFixture::value_type;
542
- this ->cache .init ( this -> ref , this -> default_global_size ,
543
- this ->default_local_size );
544
- auto buffer = this -> cache . template get <value_type>( this ->comm );
545
+ auto buffer = this ->cache .template get <value_type>(
546
+ this -> ref , this -> comm , this ->default_global_size ,
547
+ this ->default_local_size );
545
548
546
549
gko::experimental::distributed::detail::GenericVectorCache cache (
547
550
std::move (this ->cache ));
@@ -554,9 +557,9 @@ TYPED_TEST(GenericVectorCache, WorkspaceIsNotMoved)
554
557
TYPED_TEST (GenericVectorCache, WorkspaceIsNotCopyAssigned)
555
558
{
556
559
using value_type = typename TestFixture::value_type;
557
- this ->cache .init ( this -> ref , this -> default_global_size ,
558
- this ->default_local_size );
559
- auto buffer = this -> cache . template get <value_type>( this ->comm );
560
+ auto buffer = this ->cache .template get <value_type>(
561
+ this -> ref , this -> comm , this ->default_global_size ,
562
+ this ->default_local_size );
560
563
gko::experimental::distributed::detail::GenericVectorCache cache;
561
564
562
565
cache = this ->cache ;
@@ -569,9 +572,9 @@ TYPED_TEST(GenericVectorCache, WorkspaceIsNotCopyAssigned)
569
572
TYPED_TEST (GenericVectorCache, WorkspaceIsNotMoveAssigned)
570
573
{
571
574
using value_type = typename TestFixture::value_type;
572
- this ->cache .init ( this -> ref , this -> default_global_size ,
573
- this ->default_local_size );
574
- auto buffer = this -> cache . template get <value_type>( this ->comm );
575
+ auto buffer = this ->cache .template get <value_type>(
576
+ this -> ref , this -> comm , this ->default_global_size ,
577
+ this ->default_local_size );
575
578
gko::experimental::distributed::detail::GenericVectorCache cache;
576
579
577
580
cache = std::move (this ->cache );
0 commit comments