@@ -1284,7 +1284,7 @@ TEST_F(RDFSnapshotMT, Reshuffled_friends)
1284
1284
TEST (RDFSnapshotMore, ManyTasksPerThread)
1285
1285
{
1286
1286
const auto nSlots = 4u ;
1287
- ROOT::EnableImplicitMT (nSlots);
1287
+ TIMTEnabler imt (nSlots);
1288
1288
// make sure the file is not here beforehand
1289
1289
gSystem ->Unlink (" snapshot_manytasks_out.root" );
1290
1290
@@ -1314,8 +1314,6 @@ TEST(RDFSnapshotMore, ManyTasksPerThread)
1314
1314
for (auto i = 0u ; i < nInputFiles; ++i)
1315
1315
gSystem ->Unlink ((inputFilePrefix + std::to_string (i) + " .root" ).c_str ());
1316
1316
gSystem ->Unlink (outputFile);
1317
-
1318
- ROOT::DisableImplicitMT ();
1319
1317
}
1320
1318
1321
1319
void checkSnapshotArrayFileMT (RResultPtr<RInterface<RLoopManager>> &df, unsigned int kNEvents )
@@ -1333,35 +1331,31 @@ void checkSnapshotArrayFileMT(RResultPtr<RInterface<RLoopManager>> &df, unsigned
1333
1331
1334
1332
TEST_F (RDFSnapshotArrays, MultiThread)
1335
1333
{
1336
- ROOT::EnableImplicitMT (4 );
1334
+ TIMTEnabler imt (4 );
1337
1335
1338
1336
RDataFrame tdf (" arrayTree" , kFileNames );
1339
1337
auto dt = tdf.Snapshot (" outTree" , " test_snapshotRVecoutMT.root" ,
1340
1338
{" fixedSizeArr" , " size" , " varSizeArr" , " varSizeBoolArr" , " fixedSizeBoolArr" });
1341
1339
1342
1340
checkSnapshotArrayFileMT (dt, kNEvents );
1343
-
1344
- ROOT::DisableImplicitMT ();
1345
1341
}
1346
1342
1347
1343
TEST_F (RDFSnapshotArrays, MultiThreadJitted)
1348
1344
{
1349
- ROOT::EnableImplicitMT (4 );
1345
+ TIMTEnabler imt (4 );
1350
1346
1351
1347
RDataFrame tdf (" arrayTree" , kFileNames );
1352
1348
auto dj = tdf.Snapshot (" outTree" , " test_snapshotRVecoutMTJitted.root" ,
1353
1349
{" fixedSizeArr" , " size" , " varSizeArr" , " varSizeBoolArr" , " fixedSizeBoolArr" });
1354
1350
1355
1351
checkSnapshotArrayFileMT (dj, kNEvents );
1356
-
1357
- ROOT::DisableImplicitMT ();
1358
1352
}
1359
1353
1360
1354
TEST_F (RDFSnapshotArrays, RedefineArrayMT)
1361
1355
{
1362
1356
static constexpr unsigned int newArraySize = 6u ;
1363
1357
static_assert (kFixedSize != newArraySize);
1364
- ROOT::EnableImplicitMT (3 );
1358
+ TIMTEnabler (3 );
1365
1359
1366
1360
// More input files than threads, so output branches need to be bound to new inputs
1367
1361
std::vector<std::string> fileNames (kFileNames );
@@ -1383,7 +1377,6 @@ TEST_F(RDFSnapshotArrays, RedefineArrayMT)
1383
1377
},
1384
1378
{" fixedSizeArr" });
1385
1379
1386
- ROOT::DisableImplicitMT ();
1387
1380
gSystem ->Unlink (" test_snapshotRVecRedefineArray.root" );
1388
1381
}
1389
1382
@@ -1418,7 +1411,7 @@ TEST(RDFSnapshotMore, ColsWithCustomTitlesMT)
1418
1411
WriteColsWithCustomTitles (tname, fname);
1419
1412
1420
1413
// read and write test tree with RDF (in parallel)
1421
- ROOT::EnableImplicitMT (4 );
1414
+ TIMTEnabler imt (4 );
1422
1415
RDataFrame d (tname, fname);
1423
1416
const std::string prefix = " snapshotted_" ;
1424
1417
auto res_tdf = d.Snapshot (tname, prefix + fname, {" i" , " float" , " arrint" , " vararrint" });
@@ -1430,7 +1423,7 @@ TEST(RDFSnapshotMore, ColsWithCustomTitlesMT)
1430
1423
// clean-up
1431
1424
gSystem ->Unlink (fname);
1432
1425
gSystem ->Unlink ((prefix + fname).c_str ());
1433
- ROOT::DisableImplicitMT ();
1426
+
1434
1427
}
1435
1428
1436
1429
TEST (RDFSnapshotMore, TreeWithFriendsMT)
@@ -1440,7 +1433,7 @@ TEST(RDFSnapshotMore, TreeWithFriendsMT)
1440
1433
RDataFrame (10 ).Define (" x" , []() { return 42 ; }).Snapshot (" t" , fname1, {" x" });
1441
1434
RDataFrame (10 ).Define (" x" , []() { return 0 ; }).Snapshot (" t" , fname2, {" x" });
1442
1435
1443
- ROOT::EnableImplicitMT ( );
1436
+ TIMTEnabler imt ( 0 );
1444
1437
1445
1438
TFile file (fname1);
1446
1439
auto tree = file.Get <TTree>(" t" );
@@ -1454,7 +1447,6 @@ TEST(RDFSnapshotMore, TreeWithFriendsMT)
1454
1447
EXPECT_EQ (df_out->Max <int >(" x" ).GetValue (), 42 );
1455
1448
EXPECT_EQ (df_out->GetColumnNames (), std::vector<std::string>{" x" });
1456
1449
1457
- ROOT::DisableImplicitMT ();
1458
1450
gSystem ->Unlink (fname1);
1459
1451
gSystem ->Unlink (fname2);
1460
1452
gSystem ->Unlink (outfname);
@@ -1481,13 +1473,13 @@ TEST(RDFSnapshotMore, JittedSnapshotAndAliasedColumns)
1481
1473
1482
1474
TEST (RDFSnapshotMore, LazyNotTriggeredMT)
1483
1475
{
1484
- ROOT::EnableImplicitMT (4 );
1476
+ TIMTEnabler imt (4 );
1485
1477
ROOT_EXPECT_WARNING (BookLazySnapshot (), " Snapshot" ,
1486
1478
" A lazy Snapshot action was booked but never triggered. The tree 't' in output file "
1487
1479
" 'lazysnapshotnottriggered_shouldnotbecreated.root' was not created. "
1488
1480
" In case it was desired instead, remember to trigger the Snapshot operation, by "
1489
1481
" storing its result in a variable and for example calling the GetValue() method on it." );
1490
- ROOT::DisableImplicitMT ();
1482
+
1491
1483
}
1492
1484
1493
1485
TEST (RDFSnapshotMore, LazyTriggeredMT)
@@ -1504,7 +1496,7 @@ TEST(RDFSnapshotMore, EmptyBuffersMT)
1504
1496
const auto fname = " emptybuffersmt.root" ;
1505
1497
const auto treename = " t" ;
1506
1498
const unsigned int nslots = std::min (4U , std::thread::hardware_concurrency ());
1507
- ROOT::EnableImplicitMT (nslots);
1499
+ TIMTEnabler imt (nslots);
1508
1500
ROOT::RDataFrame d (10 );
1509
1501
std::atomic_bool firstWorker{true };
1510
1502
auto dd = d.DefineSlot (" x" , [&](unsigned int ) {
@@ -1527,15 +1519,13 @@ TEST(RDFSnapshotMore, EmptyBuffersMT)
1527
1519
EXPECT_EQ (t->GetListOfBranches ()->GetEntries (), 1 );
1528
1520
EXPECT_EQ (t->GetEntries (), Long64_t (passed));
1529
1521
1530
- ROOT::DisableImplicitMT ();
1531
1522
gSystem ->Unlink (fname);
1532
1523
}
1533
1524
1534
1525
TEST (RDFSnapshotMore, ReadWriteCarrayMT)
1535
1526
{
1536
- ROOT::EnableImplicitMT (4 );
1527
+ TIMTEnabler imt (4 );
1537
1528
ReadWriteCarray (" ReadWriteCarrayMT" );
1538
- ROOT::DisableImplicitMT ();
1539
1529
}
1540
1530
1541
1531
TEST (RDFSnapshotMore, TClonesArrayMT)
@@ -1605,12 +1595,10 @@ TEST(RDFSnapshotMore, SetMaxTreeSizeMT)
1605
1595
// Create an RDF from the previously snapshotted file, then Snapshot again
1606
1596
// with IMT enabled.
1607
1597
{
1608
- ROOT::EnableImplicitMT ( );
1598
+ TIMTEnabler imt ( 0 );
1609
1599
1610
1600
ROOT::RDataFrame df{" T" , " rdfsnapshot_ttree_sequential_setmaxtreesize.root" };
1611
1601
df.Snapshot (" T" , " rdfsnapshot_imt_setmaxtreesize.root" , {" x" });
1612
-
1613
- ROOT::DisableImplicitMT ();
1614
1602
}
1615
1603
1616
1604
// Check the file for data integrity.
@@ -1655,25 +1643,22 @@ TEST(RDFSnapshotMore, ZeroOutputEntriesMT)
1655
1643
1656
1644
TEST (RDFSnapshotMore, CustomBasketSizeMT)
1657
1645
{
1658
- ROOT::EnableImplicitMT ( );
1646
+ TIMTEnabler imt ( 0 );
1659
1647
TestCustomBasketSize ();
1660
- ROOT::DisableImplicitMT ();
1661
1648
}
1662
1649
1663
1650
// Test for default basket size
1664
1651
TEST (RDFSnapshotMore, DefaultBasketSizeMT)
1665
1652
{
1666
- ROOT::EnableImplicitMT ( );
1653
+ TIMTEnabler imt ( 0 );
1667
1654
TestDefaultBasketSize ();
1668
- ROOT::DisableImplicitMT ();
1669
1655
}
1670
1656
1671
1657
// Test for basket size preservation
1672
1658
TEST (RDFSnapshotMore, BasketSizePreservationMT)
1673
1659
{
1674
- ROOT::EnableImplicitMT ( );
1660
+ TIMTEnabler imt ( 0 );
1675
1661
TestBasketSizePreservation ();
1676
- ROOT::DisableImplicitMT ();
1677
1662
}
1678
1663
1679
1664
#endif // R__USE_IMT
0 commit comments