tests.cpp 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. /**
  2. * @file tests/boost_graph/tests.cpp
  3. * @author The PARADEVS Development Team
  4. * See the AUTHORS or Authors.txt file
  5. */
  6. /*
  7. * PARADEVS - the multimodeling and simulation environment
  8. * This file is a part of the PARADEVS environment
  9. *
  10. * Copyright (C) 2013 ULCO http://www.univ-litoral.fr
  11. *
  12. * This program is free software: you can redistribute it and/or modify
  13. * it under the terms of the GNU General Public License as published by
  14. * the Free Software Foundation, either version 3 of the License, or
  15. * (at your option) any later version.
  16. *
  17. * This program is distributed in the hope that it will be useful,
  18. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  20. * GNU General Public License for more details.
  21. *
  22. * You should have received a copy of the GNU General Public License
  23. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  24. */
  25. #include <boost/timer.hpp>
  26. #include <common/RootCoordinator.hpp>
  27. #include <tests/boost_graph/models.hpp>
  28. #include <tests/boost_graph/graph_builder.hpp>
  29. #include <tests/boost_graph/graph_manager.hpp>
  30. #include <tests/boost_graph/graph_partitioning.hpp>
  31. using namespace paradevs::common;
  32. using namespace paradevs::common::scheduler;
  33. using namespace paradevs::pdevs;
  34. using namespace paradevs::tests::boost_graph;
  35. void flat_test()
  36. {
  37. RootCoordinator <
  38. DoubleTime,
  39. paradevs::pdevs::Coordinator <
  40. DoubleTime,
  41. SchedulerType,
  42. SchedulerHandle,
  43. InBuildFlatGraphManager <
  44. SchedulerHandle,
  45. FlatGraphBuilder >,
  46. paradevs::common::NoParameters,
  47. paradevs::common::NoParameters >
  48. > rc(0, 100000, "root", NoParameters(), NoParameters());
  49. rc.run();
  50. }
  51. void hierarchical_test()
  52. {
  53. RootCoordinator <
  54. DoubleTime,
  55. paradevs::pdevs::Coordinator <
  56. DoubleTime,
  57. SchedulerType,
  58. SchedulerHandle,
  59. HierarchicalGraphManager <
  60. SchedulerHandle,
  61. HierarchicalGraphBuilder >,
  62. paradevs::common::NoParameters,
  63. paradevs::common::NoParameters >
  64. > rc(0, 100, "root", NoParameters(), NoParameters());
  65. rc.run();
  66. }
  67. void partitionning_test()
  68. {
  69. RootCoordinator <
  70. DoubleTime,
  71. paradevs::pdevs::Coordinator <
  72. DoubleTime,
  73. SchedulerType,
  74. SchedulerHandle,
  75. HierarchicalGraphManager <
  76. SchedulerHandle,
  77. PartitioningGraphBuilder >,
  78. paradevs::common::NoParameters,
  79. paradevs::common::NoParameters >
  80. > rc(0, 100000, "root", NoParameters(), NoParameters());
  81. std::cout << rc.to_string() << std::endl;
  82. rc.run();
  83. }
  84. int main()
  85. {
  86. boost::timer t;
  87. std::cout << "flat graph ..." << std::endl;
  88. flat_test();
  89. double t2 = t.elapsed();
  90. std::cout << "... OK -> " << t2 << std::endl;
  91. //hierarchical_test();
  92. std::cout << "partitioning graph ..." << std::endl;
  93. partitionning_test();
  94. double t3 = t.elapsed();
  95. std::cout << "... OK -> " << (t3 - t2) << std::endl;
  96. return 0;
  97. }