Skip to content

Commit

Permalink
Adjust compile args for Windows.
Browse files Browse the repository at this point in the history
  • Loading branch information
moorepants committed May 24, 2024
1 parent 889c1b3 commit e9728f9
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions opty/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,10 @@ def openmp_installed():
customize_compiler(ccompiler)
try:
# .compile() should return ['test.o'] on linux
ccompiler.compile([filename], extra_postargs=['-fopenmp'])
if sys.platform == "win32":
ccompiler.compile([filename], extra_postargs=['/openmp'])
else:
ccompiler.compile([filename], extra_postargs=['-fopenmp'])
exit = True
except CompileError:
exit = False
Expand Down Expand Up @@ -574,8 +577,12 @@ def ufuncify_matrix(args, expr, const=None, tmp_dir=None, parallel=False,
if parallel and openmp:
d['loop_sig'] = "prange(n, nogil=True)"
d['head_gil'] = " nogil"
d['compile_args'] = "'-fopenmp'"
d['link_args'] = "'-fopenmp'"
if sys.platform == "win32":
d['compile_args'] = "'\openmp'"
d['link_args'] = ""
else:
d['compile_args'] = "'-fopenmp'"
d['link_args'] = "'-fopenmp'"
else:
d['loop_sig'] = "range(n)"
d['head_gil'] = ""
Expand Down

0 comments on commit e9728f9

Please sign in to comment.