Skip to content

Commit

Permalink
Merge pull request #117 from arcaneframework/dev/mab/cleanup
Browse files Browse the repository at this point in the history
Clean up old timer #116
  • Loading branch information
mohd-afeef-badri authored Feb 3, 2024
2 parents 4894bc7 + d4d9810 commit 2427a35
Show file tree
Hide file tree
Showing 10 changed files with 16 additions and 470 deletions.
2 changes: 1 addition & 1 deletion poisson/BlCsrBiliAssembly.hxx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
//-----------------------------------------------------------------------------
// Copyright 2000-2023 CEA (www.cea.fr) IFPEN (www.ifpenergiesnouvelles.com)
// Copyright 2000-2024 CEA (www.cea.fr) IFPEN (www.ifpenergiesnouvelles.com)
// See the top-level COPYRIGHT file for details.
// SPDX-License-Identifier: Apache-2.0
//-----------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion poisson/CooBiliAssembly.hxx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
//-----------------------------------------------------------------------------
// Copyright 2000-2023 CEA (www.cea.fr) IFPEN (www.ifpenergiesnouvelles.com)
// Copyright 2000-2024 CEA (www.cea.fr) IFPEN (www.ifpenergiesnouvelles.com)
// See the top-level COPYRIGHT file for details.
// SPDX-License-Identifier: Apache-2.0
//-----------------------------------------------------------------------------
Expand Down
58 changes: 2 additions & 56 deletions poisson/CooSortBiliAssembly.hxx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
//-----------------------------------------------------------------------------
// Copyright 2000-2023 CEA (www.cea.fr) IFPEN (www.ifpenergiesnouvelles.com)
// Copyright 2000-2024 CEA (www.cea.fr) IFPEN (www.ifpenergiesnouvelles.com)
// See the top-level COPYRIGHT file for details.
// SPDX-License-Identifier: Apache-2.0
//-----------------------------------------------------------------------------
Expand Down Expand Up @@ -73,49 +73,23 @@ _assembleCooSortBilinearOperatorTRIA3()

Timer::Action timer_coosort_bili(m_time_stats, "AssembleCooSortBilinearOperatorTria3");

double compute_average = 0;
double global_build_average = 0;
double build_time = 0;
std::chrono::_V2::system_clock::time_point lhs_start;
if (m_register_time) {
logger << "-------------------------------------------------------------------------------------\n"
<< "Using CPU coo with NumArray format\n";
lhs_start = std::chrono::high_resolution_clock::now();
}
{
Timer::Action timer_build_coosort(m_time_stats, "BuildMatrixCooSort");
// Build the coo matrix
_buildMatrixSort();
}
if (m_register_time) {
auto build_stop = std::chrono::high_resolution_clock::now();
std::chrono::duration<double> build_duration = build_stop - lhs_start;
build_time = build_duration.count();
}

auto node_dof(m_dofs_on_nodes.nodeDoFConnectivityView());

ENUMERATE_ (Cell, icell, allCells()) {
Cell cell = *icell;

std::chrono::_V2::system_clock::time_point compute_El_start;
if (m_register_time) {
compute_El_start = std::chrono::high_resolution_clock::now();
}

FixedMatrix<3, 3> K_e;
{
//Timer::Action timer_element_coosort(m_time_stats,"CooSortComputeElementMatrixTria3");

K_e = _computeElementMatrixTRIA3(cell); // element stifness matrix
}

if (m_register_time) {
auto compute_El_stop = std::chrono::high_resolution_clock::now();
std::chrono::duration<double> compute_duration = compute_El_stop - compute_El_start;
compute_average += compute_duration.count();
}

// # assemble elementary matrix into the global one
// # elementary terms are positionned into K according
// # to the rank of associated node in the mesh.nodes list
Expand All @@ -124,10 +98,6 @@ _assembleCooSortBilinearOperatorTRIA3()
// for node2 in elem.nodes:
// inode2=elem.nodes.index(node2)
// K[node1.rank,node2.rank]=K[node1.rank,node2.rank]+K_e[inode1,inode2]
std::chrono::_V2::system_clock::time_point global_build_start;
if (m_register_time) {
global_build_start = std::chrono::high_resolution_clock::now();
}

//Timer::Action timer_coosort_add_compute(m_time_stats, "CooSortAddToGlobalMatrix");
Int32 n1_index = 0;
Expand All @@ -144,32 +114,8 @@ _assembleCooSortBilinearOperatorTRIA3()
}
++n1_index;
}
if (m_register_time) {
auto global_build_stop = std::chrono::high_resolution_clock::now();
std::chrono::duration<double> global_build_duration = global_build_stop - global_build_start;
global_build_average += global_build_duration.count();
}
}

if (m_register_time) {
auto lhs_end = std::chrono::high_resolution_clock::now();
std::chrono::duration<double> duration = lhs_end - lhs_start;
double lhs_loc_time = duration.count();
logger << "Building time of the coo matrix :" << build_time << "\n"
<< "Compute Elements average time : " << compute_average / nbCell() << "\n"
<< "Compute Elements total time : " << compute_average << "\n"
<< "Add in global matrix average time : " << global_build_average / nbCell() << "\n"
<< "Add in global matrix total time : " << global_build_average << "\n"
<< "LHS Total time : " << lhs_loc_time << "\n"
<< "Build matrix time in lhs :" << build_time / lhs_loc_time * 100 << "%\n"
<< "Compute element time in lhs : " << compute_average / lhs_loc_time * 100 << "%\n"
<< "Add in global matrix time in lhs : " << global_build_average / lhs_loc_time * 100 << "%\n\n"
<< "-------------------------------------------------------------------------------------\n\n";
lhs_time += lhs_loc_time;
wbuild << lhs_loc_time << ",";
timer << compute_average + global_build_average << ",";
}
}

/*---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*/
59 changes: 2 additions & 57 deletions poisson/CsrBiliAssembly.hxx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
//-----------------------------------------------------------------------------
// Copyright 2000-2023 CEA (www.cea.fr) IFPEN (www.ifpenergiesnouvelles.com)
// Copyright 2000-2024 CEA (www.cea.fr) IFPEN (www.ifpenergiesnouvelles.com)
// See the top-level COPYRIGHT file for details.
// SPDX-License-Identifier: Apache-2.0
//-----------------------------------------------------------------------------
Expand Down Expand Up @@ -65,49 +65,22 @@ _assembleCsrBilinearOperatorTRIA3()
{

Timer::Action timer_csr_bili(m_time_stats, "AssembleCsrBilinearOperatorTria3");

double compute_average = 0;
double global_build_average = 0;
double build_time = 0;
std::chrono::_V2::system_clock::time_point lhs_start;
if (m_register_time) {
logger << "-------------------------------------------------------------------------------------\n"
<< "Using CPU CSR with NumArray format\n";
lhs_start = std::chrono::high_resolution_clock::now();
}
{
Timer::Action timer_csr_build(m_time_stats, "CsrBuildMatrix");
// Build the csr matrix
_buildMatrixCsr();
}

std::chrono::_V2::system_clock::time_point build_stop;
if (m_register_time) {
build_stop = std::chrono::high_resolution_clock::now();
std::chrono::duration<double> build_duration = build_stop - lhs_start;
build_time = build_duration.count();
}

auto node_dof(m_dofs_on_nodes.nodeDoFConnectivityView());

ENUMERATE_ (Cell, icell, allCells()) {
Cell cell = *icell;
std::chrono::_V2::system_clock::time_point compute_El_start;
if (m_register_time)
compute_El_start = std::chrono::high_resolution_clock::now();

FixedMatrix<3, 3> K_e;
{
//Timer::Action timer_csr_compute_add(m_time_stats, "CsrComputeElementMatrixTria3");
K_e = _computeElementMatrixTRIA3(cell); // element stifness matrix
}

if (m_register_time) {
auto compute_El_stop = std::chrono::high_resolution_clock::now();
std::chrono::duration<double> compute_duration = compute_El_stop - compute_El_start;
compute_average += compute_duration.count();
}

// # assemble elementary matrix into the global one
// # elementary terms are positionned into K according
// # to the rank of associated node in the mesh.nodes list
Expand All @@ -116,10 +89,7 @@ _assembleCsrBilinearOperatorTRIA3()
// for node2 in elem.nodes:
// inode2=elem.nodes.index(node2)
// K[node1.rank,node2.rank]=K[node1.rank,node2.rank]+K_e[inode1,inode2]
std::chrono::_V2::system_clock::time_point global_build_start;
if (m_register_time) {
global_build_start = std::chrono::high_resolution_clock::now();
}

//Timer::Action timer_action(m_time_stats, "CsrAddToGlobalMatrix");
Int32 n1_index = 0;
for (Node node1 : cell.nodes()) {
Expand All @@ -135,31 +105,6 @@ _assembleCsrBilinearOperatorTRIA3()
}
++n1_index;
}

if (m_register_time) {
auto global_build_stop = std::chrono::high_resolution_clock::now();
std::chrono::duration<double> global_build_duration = global_build_stop - global_build_start;
global_build_average += global_build_duration.count();
}
}

if (m_register_time) {
auto lhs_end = std::chrono::high_resolution_clock::now();
std::chrono::duration<double> duration = lhs_end - lhs_start;
double lhs_loc_time = duration.count();
logger << "Building time of the csr matrix :" << build_time << "\n"
<< "Compute Elements average time : " << compute_average / nbCell() << "\n"
<< "Compute Elements total time : " << compute_average << "\n"
<< "Add in global matrix average time : " << global_build_average / nbCell() << "\n"
<< "Add in global matrix total time : " << global_build_average << "\n"
<< "LHS Total time : " << lhs_loc_time << "\n"
<< "Build matrix time in lhs :" << build_time / lhs_loc_time * 100 << "%\n"
<< "Compute element time in lhs : " << compute_average / lhs_loc_time * 100 << "%\n"
<< "Add in global matrix time in lhs : " << global_build_average / lhs_loc_time * 100 << "%\n\n"
<< "-------------------------------------------------------------------------------------\n\n";
lhs_time += lhs_loc_time;
wbuild << lhs_loc_time << ",";
timer << compute_average + global_build_average << ",";
}
}

Expand Down
2 changes: 1 addition & 1 deletion poisson/CsrGpuBiliAssembly.hxx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
//-----------------------------------------------------------------------------
// Copyright 2000-2023 CEA (www.cea.fr) IFPEN (www.ifpenergiesnouvelles.com)
// Copyright 2000-2024 CEA (www.cea.fr) IFPEN (www.ifpenergiesnouvelles.com)
// See the top-level COPYRIGHT file for details.
// SPDX-License-Identifier: Apache-2.0
//-----------------------------------------------------------------------------
Expand Down
Loading

0 comments on commit 2427a35

Please sign in to comment.