LCOV - code coverage report
Current view: top level - src/utility - LAGraph_SetNumThreads.c (source / functions) Hit Total Coverage
Test: LAGraph code coverage report. Commit id: cc56ed4. Current time (UTC): 2024-08-30T17:14:30Z Lines: 8 8 100.0 %
Date: 2024-08-30 17:16:41 Functions: 1 1 100.0 %

          Line data    Source code
       1             : //------------------------------------------------------------------------------
       2             : // LAGraph_SetNumThreads: set the # of threads to use
       3             : //------------------------------------------------------------------------------
       4             : 
       5             : // LAGraph, (c) 2019-2022 by The LAGraph Contributors, All Rights Reserved.
       6             : // SPDX-License-Identifier: BSD-2-Clause
       7             : //
       8             : // For additional details (including references to third party source code and
       9             : // other files) see the LICENSE file or contact permission@sei.cmu.edu. See
      10             : // Contributors.txt for a full list of contributors. Created, in part, with
      11             : // funding and support from the U.S. Government (see Acknowledgments.txt file).
      12             : // DM22-0790
      13             : 
      14             : // Contributed by Timothy A. Davis, Texas A&M University
      15             : 
      16             : //------------------------------------------------------------------------------
      17             : 
      18             : #include "LG_internal.h"
      19             : 
      20          12 : int LAGraph_SetNumThreads
      21             : (
      22             :     // input:
      23             :     int nthreads_outer,
      24             :     int nthreads_inner,
      25             :     char *msg
      26             : )
      27             : {
      28             : 
      29             :     //--------------------------------------------------------------------------
      30             :     // check inputs
      31             :     //--------------------------------------------------------------------------
      32             : 
      33          12 :     LG_CLEAR_MSG ;
      34             : 
      35             :     //--------------------------------------------------------------------------
      36             :     // set number of threads to use
      37             :     //--------------------------------------------------------------------------
      38             : 
      39          12 :     nthreads_outer = LAGRAPH_MAX (nthreads_outer, 1) ;
      40          12 :     nthreads_inner = LAGRAPH_MAX (nthreads_inner, 1) ;
      41             : 
      42             :     #if LAGRAPH_SUITESPARSE
      43             :     {
      44             :         // SuiteSparse:GraphBLAS: set # of threads with global setting
      45          12 :         GRB_TRY (GxB_set (GxB_NTHREADS, nthreads_inner)) ;
      46             :     }
      47             :     #endif
      48             : 
      49             :     // set # of LAGraph threads
      50          12 :     LG_nthreads_outer = nthreads_outer ;    // for LAGraph itself, if nested
      51             :                                             // regions call GraphBLAS
      52          12 :     LG_nthreads_inner = nthreads_inner ;    // for lower-level parallelism
      53             : 
      54          12 :     return (GrB_SUCCESS) ;
      55             : }

Generated by: LCOV version 1.14