Skip to content

Commit

Permalink
ifdefs for openmp
Browse files Browse the repository at this point in the history
  • Loading branch information
DrTimothyAldenDavis committed Jan 2, 2025
1 parent 5239da2 commit 19e8dea
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 1 deletion.
2 changes: 2 additions & 0 deletions experimental/algorithm/LAGraph_Coarsen_Matching.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@ This method requires O(n + e) space for an undirected graph with e edges and n n
#include "LG_internal.h"
#include "LAGraphX.h"

#ifdef OPENMP_
#include <omp.h>
#endif

// #define dbg
// #define burble
Expand Down
2 changes: 2 additions & 0 deletions experimental/algorithm/LAGraph_argminmax.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

#include "LG_internal.h"
#include "LAGraphX.h"
#ifdef OPENMP_
#include <omp.h>
#endif
#include <LAGraph.h>

// #define USAGE "usage: [x,p] = LAGraph_argminmax (A, minmax, dim)"
Expand Down
13 changes: 12 additions & 1 deletion experimental/algorithm/LAGraph_cdlp.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@

#include <LAGraph.h>
#include <LAGraphX.h>
#ifdef OPENMP_
#include <omp.h>
#endif
#include <stdalign.h>
#include "LG_internal.h"

Expand Down Expand Up @@ -198,7 +200,11 @@ int LAGraph_cdlp
GrB_Index *Sp = NULL, *Si = NULL, *Tp = NULL, *Ti = NULL, *L = NULL, *L_next = NULL ;
ptable *counts_pool = NULL ;

#ifdef OPENMP_
size_t max_threads = omp_get_max_threads();
#else
size_t max_threads = 1 ;
#endif

//--------------------------------------------------------------------------
// check inputs
Expand Down Expand Up @@ -269,7 +275,12 @@ int LAGraph_cdlp

#pragma omp parallel for schedule(dynamic)
for (GrB_Index i = 0; i < n; i++) {
ptable *counts = &counts_pool[omp_get_thread_num()];
#ifdef OPENMP_
int thread_id = omp_get_thread_num ( ) ;
#else
int thread_id = 1 ;
#endif
ptable *counts = &counts_pool[thread_id];
GrB_Index* neighbors = Si + Sp[i] ;
GrB_Index sz = Sp[i+1] - Sp[i] ;
for (GrB_Index j = 0; j < sz; j++) {
Expand Down
2 changes: 2 additions & 0 deletions experimental/benchmark/matching_demo.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ NOTE: When complete, prints out the matching vector and E matrix of the input gr
#include "../../src/benchmark/LAGraph_demo.h"
#include "LG_internal.h"
#include "LAGraphX.h"
#ifdef OPENMP_
#include <omp.h>
#endif

// #define VERBOSE

Expand Down
2 changes: 2 additions & 0 deletions experimental/utility/LAGraph_Incidence_Matrix.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ Note that complex types are NOT supported.
#include "LG_internal.h"
#include "LAGraphX.h"

#ifdef OPENMP_
#include <omp.h>
#endif

// #define dbg

Expand Down

0 comments on commit 19e8dea

Please sign in to comment.