Skip to content

Commit

Permalink
Make mandel_main to work without Cython
Browse files Browse the repository at this point in the history
  • Loading branch information
jussienko committed Sep 16, 2020
1 parent 5ae6f0d commit 208cc38
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
12 changes: 9 additions & 3 deletions demos/cython/mandel_main.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
from mandel import compute_mandel as compute_mandel_py
from mandel_cyt import compute_mandel as compute_mandel_cyt
import numpy as np
import matplotlib.pyplot as plt
import sys
from mandel import compute_mandel as compute_mandel_py
try:
from mandel_cyt import compute_mandel as compute_mandel_cyt
except ImportError:
pass

def plot_mandel(mandel):
plt.imshow(mandel)
Expand All @@ -20,7 +23,10 @@ def main(version='py'):
mandel_func = compute_mandel_py
elif version == 'cyt':
print("Using Cython")
mandel_func = compute_mandel_cyt
try:
mandel_func = compute_mandel_cyt
except NameError as ex:
raise RuntimeError("Cython extension missing") from ex
else:
raise RuntimeError("Unknown version")

Expand Down
1 change: 1 addition & 0 deletions demos/performance/mandel.py
1 change: 1 addition & 0 deletions demos/performance/mandel_main.py

0 comments on commit 208cc38

Please sign in to comment.