Add more variants for STREAM to customize build (#37283)
* Added STREAM builds customization * Changed stream_type to enum * fix code style issues Signed-off-by: Andrey Parfenov <andrey.parfenov@intel.com> * rm not necessary optimization Signed-off-by: Andrey Parfenov <andrey.parfenov@intel.com> --------- Signed-off-by: Andrey Parfenov <andrey.parfenov@intel.com> Co-authored-by: iermolae <igor.ermolaev@intel.com>
This commit is contained in:
		| @@ -18,12 +18,26 @@ class Stream(MakefilePackage): | ||||
| 
 | ||||
|     variant("openmp", default=False, description="Build with OpenMP support") | ||||
| 
 | ||||
|     variant("stream_array_size", default="none", description="Size of work arrays in elements") | ||||
|     variant( | ||||
|         "ntimes", | ||||
|         default="none", | ||||
|         description='STREAM runs each kernel "NTIMES" times and reports the *best* result', | ||||
|     ) | ||||
|     variant("offset", default="none", description="Relative alignment between arrays") | ||||
|     variant( | ||||
|         "stream_type", | ||||
|         default="none", | ||||
|         values=("none", "float", "double", "int", "long"), | ||||
|         description="Datatype of arrays elements", | ||||
|     ) | ||||
| 
 | ||||
|     def edit(self, spec, prefix): | ||||
|         makefile = FileFilter("Makefile") | ||||
| 
 | ||||
|         # Use the Spack compiler wrappers | ||||
|         makefile.filter("CC = .*", "CC = cc") | ||||
|         makefile.filter("FC = .*", "FC = f77") | ||||
|         makefile.filter("CC = .*", "CC = {0}".format(spack_cc)) | ||||
|         makefile.filter("FC = .*", "FC = {0}".format(spack_f77)) | ||||
| 
 | ||||
|         cflags = "-O2" | ||||
|         fflags = "-O2" | ||||
| @@ -33,6 +47,17 @@ def edit(self, spec, prefix): | ||||
|         if "%aocc" in self.spec: | ||||
|             cflags += " -mcmodel=large -ffp-contract=fast -fnt-store" | ||||
| 
 | ||||
|         if self.spec.variants["stream_array_size"].value != "none": | ||||
|             cflags += " -DSTREAM_ARRAY_SIZE={0}".format( | ||||
|                 self.spec.variants["stream_array_size"].value | ||||
|             ) | ||||
|         if self.spec.variants["ntimes"].value != "none": | ||||
|             cflags += " -DNTIMES={0}".format(self.spec.variants["ntimes"].value) | ||||
|         if self.spec.variants["offset"].value != "none": | ||||
|             cflags += " -DOFFSET={0}".format(self.spec.variants["offset"].value) | ||||
|         if self.spec.variants["stream_type"].value != "none": | ||||
|             cflags += " -DSTREAM_TYPE={0}".format(self.spec.variants["stream_type"].value) | ||||
| 
 | ||||
|         # Set the appropriate flags for this compiler | ||||
|         makefile.filter("CFLAGS = .*", "CFLAGS = {0}".format(cflags)) | ||||
|         makefile.filter("FFLAGS = .*", "FFLAGS = {0}".format(fflags)) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Andrey Parfenov
					Andrey Parfenov