diff --git a/poisson/BlCsrBiliAssembly.hxx b/poisson/BlCsrBiliAssembly.hxx index 2c79bdf..41e7da2 100644 --- a/poisson/BlCsrBiliAssembly.hxx +++ b/poisson/BlCsrBiliAssembly.hxx @@ -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 //----------------------------------------------------------------------------- diff --git a/poisson/CooBiliAssembly.hxx b/poisson/CooBiliAssembly.hxx index eec62d5..303a990 100644 --- a/poisson/CooBiliAssembly.hxx +++ b/poisson/CooBiliAssembly.hxx @@ -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 //----------------------------------------------------------------------------- diff --git a/poisson/CooSortBiliAssembly.hxx b/poisson/CooSortBiliAssembly.hxx index e1cdcd3..d7f65a0 100644 --- a/poisson/CooSortBiliAssembly.hxx +++ b/poisson/CooSortBiliAssembly.hxx @@ -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 //----------------------------------------------------------------------------- @@ -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 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 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 @@ -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; @@ -144,32 +114,8 @@ _assembleCooSortBilinearOperatorTRIA3() } ++n1_index; } - if (m_register_time) { - auto global_build_stop = std::chrono::high_resolution_clock::now(); - std::chrono::duration 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 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 << ","; } } /*---------------------------------------------------------------------------*/ -/*---------------------------------------------------------------------------*/ \ No newline at end of file +/*---------------------------------------------------------------------------*/ diff --git a/poisson/CsrBiliAssembly.hxx b/poisson/CsrBiliAssembly.hxx index 2c1bbe6..7f4dab0 100644 --- a/poisson/CsrBiliAssembly.hxx +++ b/poisson/CsrBiliAssembly.hxx @@ -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 //----------------------------------------------------------------------------- @@ -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 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 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 @@ -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()) { @@ -135,31 +105,6 @@ _assembleCsrBilinearOperatorTRIA3() } ++n1_index; } - - if (m_register_time) { - auto global_build_stop = std::chrono::high_resolution_clock::now(); - std::chrono::duration 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 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 << ","; } } diff --git a/poisson/CsrGpuBiliAssembly.hxx b/poisson/CsrGpuBiliAssembly.hxx index 7c61010..3cd8fb5 100644 --- a/poisson/CsrGpuBiliAssembly.hxx +++ b/poisson/CsrGpuBiliAssembly.hxx @@ -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 //----------------------------------------------------------------------------- diff --git a/poisson/CusparseBiliAssembly.hxx b/poisson/CusparseBiliAssembly.hxx index 898315c..d62820f 100644 --- a/poisson/CusparseBiliAssembly.hxx +++ b/poisson/CusparseBiliAssembly.hxx @@ -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 //----------------------------------------------------------------------------- @@ -43,17 +43,12 @@ printCsrMatrix(std::string fileName, cusparseCsr csr, bool is_coo) /*---------------------------------------------------------------------------*/ void FemModule:: -_computeCusparseElementMatrix(cusparseCsr& result, cusparseCsr& global, Cell cell, cusparseHandle_t handle, IndexedNodeDoFConnectivityView node_dof, - computeTimer& timer) +_computeCusparseElementMatrix(cusparseCsr& result, cusparseCsr& global, Cell cell, cusparseHandle_t handle, IndexedNodeDoFConnectivityView node_dof) { Timer::Action timer_action(m_time_stats, "ComputeCusparseElementMatrix"); - std::chrono::_V2::system_clock::time_point compute_start; - if (m_register_time) { - compute_start = std::chrono::high_resolution_clock::now(); - } - /*-------------------------------------------------------------------------------------------------------------------------------*/ +/*---------------------------------------------------------------------------*/ //First part : compute element matrix // Get coordiantes of the triangle element TRI3 //------------------------------------------------ @@ -87,13 +82,6 @@ _computeCusparseElementMatrix(cusparseCsr& result, cusparseCsr& global, Cell cel FixedMatrix<3, 3> int_cdPi_dPj = matrixMultiplication(matrixTranspose(b_matrix), b_matrix); int_cdPi_dPj.multInPlace(area); - std::chrono::_V2::system_clock::time_point convert_coo; - if (m_register_time) { - auto compute_el_stop = std::chrono::high_resolution_clock::now(); - std::chrono::duration compute_el_duration = compute_el_stop - compute_start; - timer.compute_el += compute_el_duration.count(); - convert_coo = std::chrono::high_resolution_clock::now(); - } /*-------------------------------------------------------------------------------------------------------------------------------*/ //Second part : putting the matrix in COO format (might want to optimsie that part by doing it earlier) before converting it to csr @@ -130,14 +118,6 @@ _computeCusparseElementMatrix(cusparseCsr& result, cusparseCsr& global, Cell cel i++; } - std::chrono::_V2::system_clock::time_point sort_coo; - std::chrono::duration convert_coo_time; - if (m_register_time) { - auto convert_coo_stop = std::chrono::high_resolution_clock::now(); - convert_coo_time = convert_coo_stop - convert_coo; - timer.convert_coo += convert_coo_time.count(); - sort_coo = std::chrono::high_resolution_clock::now(); - } //Sorting of the COO values with an insertion sort Int32 rj = 0; Int32 cj = 0; @@ -172,15 +152,6 @@ _computeCusparseElementMatrix(cusparseCsr& result, cusparseCsr& global, Cell cel vals[k + 1] = vk; } } - std::chrono::_V2::system_clock::time_point convert_csr; - if (m_register_time) { - auto sort_coo_stop = std::chrono::high_resolution_clock::now(); - std::chrono::duration sort_coo_time = sort_coo_stop - sort_coo; - std::chrono::duration convert_coo_tot = sort_coo_stop - convert_coo; - timer.sort_coo += sort_coo_time.count(); - timer.convert_coo_tot += convert_coo_tot.count(); - convert_csr = std::chrono::high_resolution_clock::now(); - } //conversion from COO to CSR void* csrRowPtr_void; @@ -190,15 +161,6 @@ _computeCusparseElementMatrix(cusparseCsr& result, cusparseCsr& global, Cell cel local.csrRow = csrRowPtr; CHECK_CUDA(cudaFree(row_indexes)); - std::chrono::_V2::system_clock::time_point adding_global; - if (m_register_time) { - auto convert_csr_stop = std::chrono::high_resolution_clock::now(); - std::chrono::duration convert_csr_time = convert_csr_stop - convert_csr; - std::chrono::duration convert_tot = convert_csr_stop - convert_coo; - timer.convert_csr_tot += convert_coo_time.count(); - timer.convert_tot += convert_tot.count(); - adding_global = std::chrono::high_resolution_clock::now(); - } /*-------------------------------------------------------------------------------------------------------------------------------*/ // Third part : adding the local and global, storing result in the res @@ -266,13 +228,6 @@ _computeCusparseElementMatrix(cusparseCsr& result, cusparseCsr& global, Cell cel CHECK_CUDA(cudaFree(local.csrRow)); CHECK_CUSPARSE(cusparseDestroyMatDescr(local.desc)); - if (m_register_time) { - auto adding_global_stop = std::chrono::high_resolution_clock::now(); - std::chrono::duration adding_tot = adding_global_stop - adding_global; - std::chrono::duration compute_tot = adding_global_stop - compute_start; - timer.add_glob += adding_tot.count(); - timer.compute_tot += compute_tot.count(); - } } /*---------------------------------------------------------------------------*/ @@ -290,29 +245,10 @@ _assembleCusparseBilinearOperatorTRIA3() Timer::Action timer_action(m_time_stats, "AssembleCusparseBilinearOperator"); - computeTimer t = {}; - std::chrono::_V2::system_clock::time_point lhs_s; - if (m_register_time) { - logger << "-------------------------------------------------------------------------------------\n" - << "Using Cusparse for Bilinear assembly\n"; - lhs_s = std::chrono::high_resolution_clock::now(); - } //Initialization of the CSR matrix; //This formula only works in p=1 - std::chrono::_V2::system_clock::time_point cuda_init_start; - if (m_register_time) { - cuda_init_start = std::chrono::high_resolution_clock::now(); - } CHECK_CUDA(cudaFree(0)); - double cuda_init = 0; - std::chrono::_V2::system_clock::time_point cuda_init_stop; - if (m_register_time) { - cuda_init_stop = std::chrono::high_resolution_clock::now(); - std::chrono::duration cuda_init_time = cuda_init_stop - cuda_init_start; - cuda_init = cuda_init_time.count(); - } - Int32 nnz = nbFace() * 2 + nbNode(); cusparseHandle_t handle; CHECK_CUSPARSE(cusparseCreate(&handle)); @@ -387,42 +323,7 @@ _assembleCusparseBilinearOperatorTRIA3() CHECK_CUDA(cudaFree(res2.csrCol)); CHECK_CUDA(cudaFree(res2.csrVal)); CHECK_CUSPARSE(cusparseDestroy(handle)); - if (m_register_time) { - auto lhs_end = std::chrono::high_resolution_clock::now(); - std::chrono::duration duration = lhs_end - cuda_init_stop; - double lhs_loc_time = duration.count(); - logger << "Average Time to compute element matrix : " << t.compute_el / nbCell() << "\n" - << "Total Time to compute element matrix : " << t.compute_el << "\n" - << "Percentage time to compute element matrix : " << t.compute_el / lhs_loc_time * 100 << "%\n" - << "Average Time to convert to coo : " << t.convert_coo / nbCell() << "\n" - << "Total Time to convert to coo : " << t.convert_coo << "\n" - << "Percentage Time to convert to coo : " << t.convert_coo / lhs_loc_time * 100 << "%\n" - << "Average Time to sort the coo : " << t.sort_coo / nbCell() << "\n" - << "Total Time to sort the coo : " << t.sort_coo << "\n" - << "Percentage Time to sort the coo : " << t.sort_coo / lhs_loc_time * 100 << "%\n" - << "Average Time to convert and sort to coo : " << t.convert_coo_tot / nbCell() << "\n" - << "Total Time to convert and sort to coo : " << t.convert_coo_tot << "\n" - << "Percentage Time to convert and sort to coo : " << t.convert_coo_tot / lhs_loc_time * 100 << "%\n" - << "Average Time to convert to csr : " << t.convert_csr_tot / nbCell() << "\n" - << "Total Time to convert to csr : " << t.convert_csr_tot << "\n" - << "Percentage Time to convert to csr : " << t.convert_csr_tot / lhs_loc_time * 100 << "%\n" - << "Average Time to convert the computed matrix : " << t.convert_tot / nbCell() << "\n" - << "Total Time to convert the computed matrix : " << t.convert_tot << "\n" - << "Percentage Time to convert the computed matrix : " << t.convert_tot / lhs_loc_time * 100 << "%\n" - << "Average Time to add to the global matrix : " << t.add_glob / nbCell() << "\n" - << "Total Time to add to the global matrix : " << t.add_glob << "\n" - << "Percentage Time to add to the global matrix : " << t.add_glob / lhs_loc_time * 100 << "%\n" - << "Average Time to make the computation operation : " << t.compute_tot / nbCell() << "\n" - << "Total Time to make the computation operation : " << t.compute_tot << "\n" - << "Percentage Time to make the computation operation : " << t.compute_tot / lhs_loc_time * 100 << "%\n" - << "Total time for the lhs computation : " << lhs_loc_time << "\n" - << "Total time of the cuda init : " << cuda_init << "\n" - << "Total time of lhs with the init : " << cuda_init + lhs_loc_time << "\n" - << "-------------------------------------------------------------------------------------\n\n"; - wbuild << lhs_loc_time << ","; - lhs_time += lhs_loc_time; - } } /*---------------------------------------------------------------------------*/ -/*---------------------------------------------------------------------------*/ \ No newline at end of file +/*---------------------------------------------------------------------------*/ diff --git a/poisson/FemModule.cc b/poisson/FemModule.cc index ce88e21..9259428 100644 --- a/poisson/FemModule.cc +++ b/poisson/FemModule.cc @@ -361,9 +361,6 @@ void FemModule:: _doStationarySolve() { Timer::Action timer_action(m_time_stats, "StationarySolve"); - std::chrono::_V2::system_clock::time_point fem_start; - if (m_register_time && m_cache_warming) - fem_start = std::chrono::high_resolution_clock::now(); // # get material parameters _getMaterialParameters(); @@ -523,16 +520,6 @@ _doStationarySolve() // Check results _checkResultFile(); - if (m_register_time) { - auto fem_stop = std::chrono::high_resolution_clock::now(); - std::chrono::duration fem_duration = fem_stop - fem_start; - double total_duration = fem_duration.count(); - logger << "FEM total duration : " << fem_duration.count() << "\n" - << "LHS time in total duration : " << lhs_time / total_duration * 100 << "%\n" - << "RHS time in total duration : " << rhs_time / total_duration * 100 << "%\n" - << "Solver time in total duration : " << solver_time / total_duration * 100 << "%\n"; - logger.close(); - } } } @@ -700,15 +687,6 @@ _assembleLinearOperator() info() << "Applying Dirichlet boundary condition via penalty method "; // time registration - std::chrono::_V2::system_clock::time_point rhs_start; - double penalty_time = 0; - double wpenalty_time = 0; - double sassembly_time = 0; - double fassembly_time = 0; - if (m_register_time) { - rhs_start = std::chrono::high_resolution_clock::now(); - } - Timer::Action timer_action(m_time_stats, "AssembleLinearOperator"); // Temporary variable to keep values for the RHS part of the linear system @@ -738,10 +716,6 @@ _assembleLinearOperator() << options()->enforceDirichletMethod() << " method "; Real Penalty = options()->penalty(); // 1.0e30 is the default - std::chrono::_V2::system_clock::time_point penalty_start; - if (m_register_time) { - penalty_start = std::chrono::high_resolution_clock::now(); - } ENUMERATE_ (Node, inode, ownNodes()) { NodeLocalId node_id = *inode; @@ -754,13 +728,6 @@ _assembleLinearOperator() rhs_values[dof_id] = u_g; } } - std::chrono::_V2::system_clock::time_point penalty_stop; - if (m_register_time) { - penalty_stop = std::chrono::high_resolution_clock::now(); - std::chrono::duration penalty_duration = penalty_stop - penalty_start; - penalty_time = penalty_duration.count(); - logger << "Penalty duration : " << penalty_time << "\n"; - } } else if (options()->enforceDirichletMethod() == "WeakPenalty") { Timer::Action timer_action(m_time_stats, "WeakPenalty"); @@ -782,10 +749,6 @@ _assembleLinearOperator() << options()->enforceDirichletMethod() << " method "; Real Penalty = options()->penalty(); // 1.0e30 is the default - std::chrono::_V2::system_clock::time_point wpenalty_start; - if (m_register_time) { - wpenalty_start = std::chrono::high_resolution_clock::now(); - } // The same as before ENUMERATE_ (Node, inode, ownNodes()) { @@ -797,13 +760,6 @@ _assembleLinearOperator() rhs_values[dof_id] = u_g; } } - std::chrono::_V2::system_clock::time_point wpenalty_stop; - if (m_register_time) { - wpenalty_stop = std::chrono::high_resolution_clock::now(); - std::chrono::duration wpenalty_duration = wpenalty_stop - wpenalty_start; - wpenalty_time = wpenalty_duration.count(); - logger << "Weak Penalty duration : " << wpenalty_time << "\n"; - } } else if (options()->enforceDirichletMethod() == "RowElimination") { @@ -854,12 +810,7 @@ _assembleLinearOperator() << " - RowElimination\n" << " - RowColumnElimination\n"; } - std::chrono::_V2::system_clock::time_point sassemby_start; - if (m_register_time) { - sassemby_start = std::chrono::high_resolution_clock::now(); - } - std::chrono::_V2::system_clock::time_point fassemby_start; { Timer::Action timer_action(m_time_stats, "ConstantSourceTermAssembly"); //---------------------------------------------- @@ -892,15 +843,6 @@ _assembleLinearOperator() } } } - - std::chrono::_V2::system_clock::time_point sassemby_stop; - if (m_register_time) { - sassemby_stop = std::chrono::high_resolution_clock::now(); - std::chrono::duration sassembly_duration = sassemby_stop - sassemby_start; - sassembly_time = sassembly_duration.count(); - logger << "Constant source term assembly duration : " << sassembly_time << "\n"; - fassemby_start = std::chrono::high_resolution_clock::now(); - } } { Timer::Action timer_action(m_time_stats, "ConstantSourceTermAssembly"); @@ -977,25 +919,6 @@ _assembleLinearOperator() continue; } } - std::chrono::_V2::system_clock::time_point fassemby_stop; - if (m_register_time) { - - fassemby_stop = std::chrono::high_resolution_clock::now(); - std::chrono::duration fassembly_duration = fassemby_stop - fassemby_start; - fassembly_time = fassembly_duration.count(); - logger << "Constant flux term assembly duration : " << fassembly_time << "\n"; - auto rhs_end = std::chrono::high_resolution_clock::now(); - std::chrono::duration duration = rhs_end - rhs_start; - rhs_time = duration.count(); - logger << "RHS total duration : " << duration.count() << "\n"; - if (penalty_time != 0) - logger << "Penalty time in rhs : " << penalty_time / rhs_time * 100 << "%\n"; - else - logger << "Weak Penalty time in rhs : " << wpenalty_time / rhs_time * 100 << "%\n"; - logger << "Constant source term assembly time in rhs : " << sassembly_time / rhs_time * 100 << "%\n" - << "Constant flux term assembly time in rhs : " << fassembly_time / rhs_time * 100 << "%\n\n" - << "-------------------------------------------------------------------------------------\n\n"; - } } } @@ -1009,15 +932,6 @@ _assembleCsrLinearOperator() info() << "Applying Dirichlet boundary condition via penalty method for Csr"; // time registration - std::chrono::_V2::system_clock::time_point rhs_start; - double penalty_time = 0; - double wpenalty_time = 0; - double sassembly_time = 0; - double fassembly_time = 0; - if (m_register_time) { - rhs_start = std::chrono::high_resolution_clock::now(); - } - Timer::Action timer_action(m_time_stats, "CsrAssembleLinearOperator"); m_rhs_vect.resize(nbNode()); @@ -1046,10 +960,6 @@ _assembleCsrLinearOperator() << options()->enforceDirichletMethod() << " method "; Real Penalty = options()->penalty(); // 1.0e30 is the default - std::chrono::_V2::system_clock::time_point penalty_start; - if (m_register_time) { - penalty_start = std::chrono::high_resolution_clock::now(); - } ENUMERATE_ (Node, inode, ownNodes()) { NodeLocalId node_id = *inode; @@ -1060,13 +970,6 @@ _assembleCsrLinearOperator() m_rhs_vect[dof_id] = u_g; } } - std::chrono::_V2::system_clock::time_point penalty_stop; - if (m_register_time) { - penalty_stop = std::chrono::high_resolution_clock::now(); - std::chrono::duration penalty_duration = penalty_stop - penalty_start; - penalty_time = penalty_duration.count(); - logger << "Penalty duration for CSR : " << penalty_time << "\n"; - } } else if (options()->enforceDirichletMethod() == "WeakPenalty") { Timer::Action timer_action(m_time_stats, "CsrWeakPenalty"); @@ -1088,10 +991,6 @@ _assembleCsrLinearOperator() << options()->enforceDirichletMethod() << " method "; Real Penalty = options()->penalty(); // 1.0e30 is the default - std::chrono::_V2::system_clock::time_point wpenalty_start; - if (m_register_time) { - wpenalty_start = std::chrono::high_resolution_clock::now(); - } // The same as before ENUMERATE_ (Node, inode, ownNodes()) { @@ -1103,13 +1002,6 @@ _assembleCsrLinearOperator() m_rhs_vect[dof_id] = u_g; } } - std::chrono::_V2::system_clock::time_point wpenalty_stop; - if (m_register_time) { - wpenalty_stop = std::chrono::high_resolution_clock::now(); - std::chrono::duration wpenalty_duration = wpenalty_stop - wpenalty_start; - wpenalty_time = wpenalty_duration.count(); - logger << "Weak Penalty duration for CSR: " << wpenalty_time << "\n"; - } } else if (options()->enforceDirichletMethod() == "RowElimination") { @@ -1160,12 +1052,7 @@ _assembleCsrLinearOperator() << " - RowElimination\n" << " - RowColumnElimination\n"; } - std::chrono::_V2::system_clock::time_point sassemby_start; - if (m_register_time) { - sassemby_start = std::chrono::high_resolution_clock::now(); - } - std::chrono::_V2::system_clock::time_point fassemby_start; { Timer::Action timer_action(m_time_stats, "CsrConstantSourceTermAssembly"); //---------------------------------------------- @@ -1187,14 +1074,6 @@ _assembleCsrLinearOperator() } } } - std::chrono::_V2::system_clock::time_point sassemby_stop; - if (m_register_time) { - sassemby_stop = std::chrono::high_resolution_clock::now(); - std::chrono::duration sassembly_duration = sassemby_stop - sassemby_start; - sassembly_time = sassembly_duration.count(); - logger << "Constant source term assembly duration for CSR: " << sassembly_time << "\n"; - fassemby_start = std::chrono::high_resolution_clock::now(); - } } { Timer::Action timer_action(m_time_stats, "CsrConstantFluxTermAssembly"); @@ -1267,25 +1146,6 @@ _assembleCsrLinearOperator() continue; } } - std::chrono::_V2::system_clock::time_point fassemby_stop; - if (m_register_time) { - - fassemby_stop = std::chrono::high_resolution_clock::now(); - std::chrono::duration fassembly_duration = fassemby_stop - fassemby_start; - fassembly_time = fassembly_duration.count(); - logger << "Constant flux term assembly duration for CSR: " << fassembly_time << "\n"; - auto rhs_end = std::chrono::high_resolution_clock::now(); - std::chrono::duration duration = rhs_end - rhs_start; - rhs_time = duration.count(); - logger << "RHS total duration for CSR: " << duration.count() << "\n"; - if (penalty_time != 0) - logger << "Penalty time in rhs for CSR: " << penalty_time / rhs_time * 100 << "%\n"; - else - logger << "Weak Penalty time in rhs for CSR: " << wpenalty_time / rhs_time * 100 << "%\n"; - logger << "Constant source term assembly time in rhs for CSR: " << sassembly_time / rhs_time * 100 << "%\n" - << "Constant flux term assembly time in rhs for CSR: " << fassembly_time / rhs_time * 100 << "%\n\n" - << "-------------------------------------------------------------------------------------\n\n"; - } } } @@ -2210,21 +2070,8 @@ _buildMatrixGPU() void FemModule:: _assembleCooGPUBilinearOperatorTRIA3() { -#if defined(m_register_time) && defined(m_cache_warming) - logger << "-------------------------------------------------------------------------------------\n" - << "Using CPU coo with NumArray format\n"; - auto lhs_start = std::chrono::high_resolution_clock::now(); - double compute_average = 0; - double global_build_average = 0; - double build_time = 0; -#endif // Build the coo matrix _buildMatrixGPU(); -#if defined(m_register_time) && defined(m_cache_warming) - auto build_stop = std::chrono::high_resolution_clock::now(); - std::chrono::duration build_duration = build_stop - lhs_start; - build_time = build_duration.count(); -#endif RunQueue* queue = acceleratorMng()->defaultQueue(); // Boucle sur les mailles déportée sur accélérateur @@ -2272,25 +2119,6 @@ _assembleCooGPUBilinearOperatorTRIA3() ++n1_index; } }; - -#if defined(m_register_time) && defined(m_cache_warming) - if (i == 3) { - auto lhs_end = std::chrono::high_resolution_clock::now(); - std::chrono::duration 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; - } -#endif } /*---------------------------------------------------------------------------*/ @@ -2304,11 +2132,6 @@ _solve() ITimeStats* tstat = m_time_stats; Timer::Action timer_action(tstat, "Solving"); - std::chrono::_V2::system_clock::time_point solve_start; - if (m_register_time) { - solve_start = std::chrono::high_resolution_clock::now(); - } - { Timer::Action ta1(tstat, "LinearSystemSolve"); // # T=linalg.solve(K,RHS) @@ -2348,19 +2171,13 @@ _solve() if (do_print) { ENUMERATE_ (Node, inode, allNodes()) { Node node = *inode; - info() << "T[" << node.localId() << "][" << node.uniqueId() << "] = " + info() << "u[" << node.localId() << "][" << node.uniqueId() << "] = " << m_u[node]; - //info() << "T[]" << node.uniqueId() << " " + //info() << "u[]" << node.uniqueId() << " " // << m_u[node]; } } - if (m_register_time) { - auto solve_end = std::chrono::high_resolution_clock::now(); - std::chrono::duration solve_duration = solve_end - solve_start; - solver_time = solve_duration.count(); - logger << "Solver duration : " << solver_time << "\n"; - } } /*---------------------------------------------------------------------------*/ diff --git a/poisson/FemModule.h b/poisson/FemModule.h index a6ab324..276b92d 100644 --- a/poisson/FemModule.h +++ b/poisson/FemModule.h @@ -147,18 +147,6 @@ struct cusparseCsr float* csrVal; }; -struct computeTimer -{ - double add_glob = 0; - double compute_el = 0; - double sort_coo = 0; - double convert_coo = 0; - double convert_coo_tot = 0; - double convert_csr_tot = 0; - double convert_tot = 0; - double iter_time = 0; - double compute_tot = 0; -}; #endif /*---------------------------------------------------------------------------*/ @@ -231,10 +219,6 @@ class FemModule std::ofstream wbuild; std::ofstream timer; - double lhs_time = 0; - double rhs_time = 0; - double solver_time = 0; - Integer cache_index; private: @@ -292,8 +276,7 @@ class FemModule #ifdef USE_CUSPARSE_ADD void printCsrMatrix(std::string fileName, cusparseCsr csr, bool is_coo); - void _computeCusparseElementMatrix(cusparseCsr& result, cusparseCsr& global, Cell icell, cusparseHandle_t handle, IndexedNodeDoFConnectivityView node_dof, - computeTimer& timer); + void _computeCusparseElementMatrix(cusparseCsr& result, cusparseCsr& global, Cell icell, cusparseHandle_t handle, IndexedNodeDoFConnectivityView node_dof); void _assembleCusparseBilinearOperatorTRIA3(); #endif void _buildMatrix(); diff --git a/poisson/LegacyBiliAssembly.hxx b/poisson/LegacyBiliAssembly.hxx index af318c3..237cbd2 100644 --- a/poisson/LegacyBiliAssembly.hxx +++ b/poisson/LegacyBiliAssembly.hxx @@ -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 //----------------------------------------------------------------------------- diff --git a/poisson/NodeWiseCsrBiliAssembly.hxx b/poisson/NodeWiseCsrBiliAssembly.hxx index 327d551..bb917e6 100644 --- a/poisson/NodeWiseCsrBiliAssembly.hxx +++ b/poisson/NodeWiseCsrBiliAssembly.hxx @@ -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 //----------------------------------------------------------------------------- @@ -56,29 +56,12 @@ void FemModule::_buildMatrixNodeWiseCsr() void FemModule::_assembleNodeWiseCsrBilinearOperatorTria3() { Timer::Action timer_blcsr_bili(m_time_stats, "AssembleNodeWiseCsrBilinearOperatorTria3"); - - std::chrono::_V2::system_clock::time_point lhs_start; - double build_time = 0; - if (m_register_time) { - logger << "-------------------------------------------------------------------------------------\n" - << "Using GPU NodeWise CSR with NumArray format\n"; - lhs_start = std::chrono::high_resolution_clock::now(); - } - { Timer::Action timer_blcsr_build(m_time_stats, "NodeWiseCsrBuildMatrix"); // Build the csr matrix _buildMatrixNodeWiseCsr(); } - std::chrono::_V2::system_clock::time_point var_init_start; - if (m_register_time) { - auto build_stop = std::chrono::high_resolution_clock::now(); - std::chrono::duration build_duration = build_stop - lhs_start; - build_time = build_duration.count(); - var_init_start = std::chrono::high_resolution_clock::now(); - } - RunQueue* queue = acceleratorMng()->defaultQueue(); // Boucle sur les noeuds déportée sur accélérateur @@ -100,15 +83,6 @@ void FemModule::_assembleNodeWiseCsrBilinearOperatorTria3() Arcane::ItemGenericInfoListView nodes_infos(this->mesh()->nodeFamily()); Arcane::ItemGenericInfoListView cells_infos(this->mesh()->cellFamily()); - std::chrono::_V2::system_clock::time_point loop_start; - double var_init_time = 0; - if (m_register_time) { - auto var_init_stop = std::chrono::high_resolution_clock::now(); - std::chrono::duration var_init_duration = var_init_stop - var_init_start; - var_init_time = var_init_duration.count(); - loop_start = std::chrono::high_resolution_clock::now(); - } - Timer::Action timer_blcsr_add_compute(m_time_stats, "NodeWiseCsrAddAndCompute"); command << RUNCOMMAND_ENUMERATE(Node, inode, allNodes()) { @@ -178,26 +152,6 @@ void FemModule::_assembleNodeWiseCsrBilinearOperatorTria3() } } }; - - if (m_register_time) { - auto lhs_end = std::chrono::high_resolution_clock::now(); - std::chrono::duration duration = lhs_end - lhs_start; - std::chrono::duration loop_duration = lhs_end - loop_start; - - double loop_time = loop_duration.count(); - double lhs_loc_time = duration.count(); - logger << "Building time of the csr matrix :" << build_time << "\n" - << "Variable initialisation time : " << var_init_time << "\n" - << "Computation and Addition time : " << loop_time << "\n" - << "LHS Total time : " << lhs_loc_time << "\n" - << "Build matrix time in lhs :" << build_time / lhs_loc_time * 100 << "%\n" - << "Variable initialisation time in lhs : " << var_init_time / lhs_loc_time * 100 << "%\n" - << "Computation and Addition time in lhs : " << loop_time / lhs_loc_time * 100 << "%\n\n" - << "-------------------------------------------------------------------------------------\n\n"; - lhs_time += lhs_loc_time; - wbuild << lhs_loc_time << "\n"; - timer << loop_time << "\n"; - } } /*---------------------------------------------------------------------------*/