Skip to content

Commit a97c565

Browse files
Merge pull request #74 from hiker/support_for_intel_on_cray
Added support for intel compiler.
2 parents d8ab93c + 0ca8924 commit a97c565

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

examples/fortran/vector_add.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/usr/bin/env python
22
"""This is a minimal example for calling Fortran functions"""
33

4+
from __future__ import print_function
45
import logging
56
import json
67
import numpy as np
@@ -21,11 +22,17 @@ def tune():
2122
tune_params["N"] = [size]
2223
tune_params["NTHREADS"] = [16, 8, 4, 2, 1]
2324

25+
print("compile with ftn using intel on cray")
26+
result, env = tune_kernel("time_vector_add", "vector_add.F90", size,
27+
args, tune_params, lang="C", compiler="ftn")
28+
2429
print("compile with gfortran")
25-
result, env = tune_kernel("time_vector_add", "vector_add.F90", size, args, tune_params, lang="C", compiler="gfortran")
30+
result, env = tune_kernel("time_vector_add", "vector_add.F90", size,
31+
args, tune_params, lang="C", compiler="gfortran")
2632

2733
print("compile with pgfortran")
28-
result, env = tune_kernel("time_vector_add", "vector_add.F90", size, args, tune_params, lang="C", compiler="pgfortran")
34+
result, env = tune_kernel("time_vector_add", "vector_add.F90", size,
35+
args, tune_params, lang="C", compiler="pgfortran")
2936

3037
return result
3138

kernel_tuner/c.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ def compile(self, kernel_name, kernel_string):
134134

135135
#select right suffix based on compiler
136136
suffix = ".cc"
137-
if self.compiler in ["gfortran", "pgfortran"]:
137+
if self.compiler in ["gfortran", "pgfortran", "ftn", "ifort"]:
138138
suffix = ".F90"
139139
if self.compiler == "nvcc":
140140
suffix = suffix[:-1] + "u"
@@ -164,6 +164,8 @@ def compile(self, kernel_name, kernel_string):
164164
if match:
165165
if self.compiler == "gfortran":
166166
kernel_name = "__" + match.group(1) + "_MOD_" + kernel_name
167+
elif self.compiler in ["ftn", "ifort"]:
168+
kernel_name = match.group(1) + "_mp_" + kernel_name + "_"
167169
elif self.compiler == "pgfortran":
168170
kernel_name = match.group(1) + "_" + kernel_name + "_"
169171

0 commit comments

Comments
 (0)