Skip to content

Commit

Permalink
disable unsupported omp in msvc fixes #9
Browse files Browse the repository at this point in the history
  • Loading branch information
david-cortes committed Apr 4, 2024
1 parent eef8735 commit 4833de3
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
2 changes: 0 additions & 2 deletions setup.cfg

This file was deleted.

2 changes: 1 addition & 1 deletion setup.py
Expand Up @@ -196,7 +196,7 @@ def test_supports_compile_arg(self, comm, with_omp=False):
'cython'
],
python_requires = ">=3",
version = '0.1.2.13-11',
version = '0.1.2.13-12',
description = 'Reductions for Cost-Sensitive Multi-Class Classification',
author = 'David Cortes',
url = 'https://github.com/david-cortes/costsensitive',
Expand Down
12 changes: 10 additions & 2 deletions src/calcv.c
Expand Up @@ -108,7 +108,11 @@ int calculate_V(double C[], double V[], size_t nrow, size_t ncol, int nthreads)
goto cleanup;
}

#pragma omp parallel for schedule(static) num_threads(nthreads) firstprivate(C, V, nrow, ncol)
#ifdef _OPENMP
#if !defined(_MSC_VER) && _OPENMP>20080101
#pragma omp parallel for schedule(static) num_threads(nthreads) firstprivate(C, V, nrow, ncol)
#endif
#endif
for (size_t row = 0; row < nrow; row++) {
argsort_naive_dbl(C + row * ncol, inner_order, buffer_argsort_dbl, ncol);
calc_cost(C + row * ncol, cost_buffer, inner_order, ncol);
Expand All @@ -120,7 +124,11 @@ int calculate_V(double C[], double V[], size_t nrow, size_t ncol, int nthreads)
}

cleanup:
#pragma omp parallel
#ifdef _OPENMP
#if !defined(_MSC_VER) && _OPENMP>20080101
#pragma omp parallel
#endif
#endif
{
free(inner_order);
free(buffer_argsort_dbl);
Expand Down

0 comments on commit 4833de3

Please sign in to comment.