Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nec #388

Open
wants to merge 11 commits into
base: unstable
Choose a base branch
from
3 changes: 3 additions & 0 deletions packages/taucmdr/cf/compiler/host.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@
ARM = HOST_COMPILERS.add('Arm', family_regex=r'Arm C/C\+\+/Fortran Compiler',
CC='armclang', CXX='armclang++', FC='armflang')

NEC_SX = HOST_COMPILERS.add('NEC', family_regex=r'NEC Corporation',
CC='ncc', CXX='nc++', FC='nfort')

CC = HOST_COMPILERS.roles['CC']
CXX = HOST_COMPILERS.roles['CXX']
FC = HOST_COMPILERS.roles['FC']
Expand Down
5 changes: 5 additions & 0 deletions packages/taucmdr/cf/compiler/mpi.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@
show_wrapper_flags=['-craype-verbose', '--version', '-E'],
CC='cc', CXX='CC', FC='ftn')

NEC_SX = MPI_COMPILERS.add('NEC', family_regex=r'NEC Corporation',
show_wrapper_flags=['-show'],
CC='mpincc', CXX='mpinc++', FC='mpinfort')


NONE = MPI_COMPILERS.add('None', #family_regex='',
CC='', CXX='', FC='')

Expand Down
6 changes: 3 additions & 3 deletions packages/taucmdr/cf/objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,14 @@ def __init__(self, x, y):
drink = Bar('water', 'sugar')

for inst in Foo.all():
print inst.x
print(inst.x)

>>> haddock
>>> potatoes
>>> potatoes

for inst in Bar.all():
print inst.x
print(inst.x)

>>> water
"""
Expand Down Expand Up @@ -132,7 +132,7 @@ def __init__(self, a):
steak = Foo('meat')

for inst in Foo.all():
print inst.a
print(inst.a)

>>> vegetable
>>> meat
Expand Down
9 changes: 9 additions & 0 deletions packages/taucmdr/cf/platforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ def is_ibm(self):
def is_arm(self):
return self in (ARM32, ARM64)

def is_nec(self):
return self in (NEC_SX)

@classmethod
def _parse_proc_cpuinfo(cls):
try:
Expand Down Expand Up @@ -248,6 +251,7 @@ def detect(cls):
PPC64LE = Architecture('ppc64le', 'IBM 64-bit PowerPC (Little Endian)')
ARM32 = Architecture('aarch32', '32-bit ARM')
ARM64 = Architecture('aarch64', '64-bit ARM')
NEC_SX = Architecture('NEC', 'NEC SX Aurora')

DARWIN = OperatingSystem('Darwin', 'Darwin')
LINUX = OperatingSystem('Linux', 'Linux')
Expand Down Expand Up @@ -327,6 +331,11 @@ def detect(cls):
MPI_COMPILERS: mpi.SYSTEM,
SHMEM_COMPILERS: shmem.OPENSHMEM})

TAU_NEC_LINUX = TauMagic((NEC_SX, LINUX), 'nec-sx-aurora',
{HOST_COMPILERS: host.NEC_SX,
MPI_COMPILERS: mpi.NEC_SX,
SHMEM_COMPILERS: shmem.OPENSHMEM})

HOST_ARCH = Architecture.detect()
HOST_OS = OperatingSystem.detect()
HOST_TAU_MAGIC = TauMagic.detect()
10 changes: 7 additions & 3 deletions packages/taucmdr/cf/software/binutils_installation.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,9 @@

LOGGER = logger.get_logger(__name__)

REPOS = {None: ['http://ftp.gnu.org/gnu/binutils/binutils-2.27.tar.gz',
'http://fs.paratools.com/tau-mirror/binutils-2.27.tar.gz']}
REPOS = {None: 'http://ftp.gnu.org/gnu/binutils/binutils-2.35.1.tar.gz'}
#REPOS = {None: ['http://ftp.gnu.org/gnu/binutils/binutils-2.27.tar.gz',
# 'http://fs.paratools.com/tau-mirror/binutils-2.27.tar.gz']}

LIBRARIES = {None: ['libbfd.a']}

Expand All @@ -65,7 +66,7 @@ def __init__(self, sources, target_arch, target_os, compilers):
target_arch, target_os, compilers, REPOS, None, LIBRARIES, None)

def configure(self, flags):
from taucmdr.cf.platforms import DARWIN, IBM_BGP, IBM_BGQ, INTEL_KNC
from taucmdr.cf.platforms import DARWIN, IBM_BGP, IBM_BGQ, INTEL_KNC, NEC_SX
flags.extend(['--disable-nls', '--disable-werror'])
for var in 'CPP', 'CC', 'CXX', 'FC', 'F77', 'F90':
os.environ.pop(var, None)
Expand Down Expand Up @@ -94,6 +95,9 @@ def configure(self, flags):
raise ConfigurationError("Cannot find KNC native compilers in /usr/linux-k1om-*")
os.environ['PATH'] = os.pathsep.join((os.path.dirname(k1om_ar), os.environ['PATH']))
flags.append('--host=x86_64-k1om-linux')
elif self.target_arch is NEC_SX:
flags.append('CC=ncc')
flags.append('CXX=nc++')
return super().configure(flags)

def make_install(self, flags):
Expand Down
32 changes: 25 additions & 7 deletions packages/taucmdr/cf/software/tau_installation.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
from taucmdr.cf.compiler.cuda import CUDA_CXX, CUDA_FC
from taucmdr.cf.compiler.caf import CAF_FC
from taucmdr.cf.compiler.python import PY
from taucmdr.cf.platforms import TauMagic, DARWIN, CRAY_CNL, IBM_BGL, IBM_BGP, IBM_BGQ, HOST_ARCH, HOST_OS
from taucmdr.cf.platforms import TauMagic, DARWIN, CRAY_CNL, IBM_BGL, IBM_BGP, IBM_BGQ, NEC_SX, HOST_ARCH, HOST_OS
from taucmdr.cf.platforms import INTEL_KNL, INTEL_KNC


Expand Down Expand Up @@ -429,10 +429,10 @@ def __init__(self, sources, target_arch, target_os, compilers,
self.unwind_depth = unwind_depth
self.uses_pdt = not minimal and (self.source_inst == 'automatic' or self.shmem_support)
self.uses_binutils = not minimal and (self.target_os is not DARWIN) and 'binutils' in sources
self.uses_libunwind = not minimal and (self.target_os is not DARWIN) and 'libunwind' in sources and self.unwinder == 'libunwind'
self.uses_libelf = not minimal and (self.target_os is not DARWIN) and 'libelf' in sources
self.uses_libdwarf = not minimal and (self.target_os is not DARWIN) and 'libdwarf' in sources and self.uses_libelf
self.uses_papi = not minimal and bool(len([met for met in self.metrics if 'PAPI' in met]))
self.uses_libunwind = not minimal and (self.target_os is not DARWIN) and (self.target_arch is not NEC_SX) and 'libunwind' in sources and self.unwinder == 'libunwind'
self.uses_libelf = not minimal and (self.target_os is not DARWIN) and (self.target_arch is not NEC_SX) and 'libelf' in sources
self.uses_libdwarf = not minimal and (self.target_os is not DARWIN) and (self.target_arch is not NEC_SX) and 'libdwarf' in sources and self.uses_libelf
self.uses_papi = not minimal and (self.target_arch is not NEC_SX) and bool(len([met for met in self.metrics if 'PAPI' in met]))
self.uses_scorep = not minimal and (self.profile == 'cubex')
self.uses_ompt = not minimal and (self.measure_openmp == 'ompt')
self.uses_ompt_tr4 = self.uses_ompt and sources['ompt'] == 'download-tr4'
Expand All @@ -441,6 +441,7 @@ def __init__(self, sources, target_arch, target_os, compilers,
self.uses_libotf2 = not minimal and (self.trace == 'otf2')
self.uses_sqlite3 = not minimal and (self.profile == 'sqlite')
self.uses_cuda = not minimal and (self.cuda_prefix and (self.cuda_support or self.opencl_support))
self.uses_zlib = self.uses_binutils
self.uses_level_zero = not minimal and self.measure_level_zero and 'level_zero' in sources
if 'TIME' not in self.metrics[0]:
# TAU assumes the first metric is always some kind of wallclock timer
Expand All @@ -457,7 +458,7 @@ def __init__(self, sources, target_arch, target_os, compilers,
mets.extend(met.split(','))
self.metrics = mets
uses = lambda pkg: sources.get(pkg, False) if forced_makefile else getattr(self, 'uses_'+pkg)
for pkg in 'binutils', 'libunwind', 'libelf', 'libdwarf', 'papi', 'pdt', 'ompt', 'libotf2', 'sqlite3', 'level_zero':
for pkg in 'binutils', 'libunwind', 'libelf', 'libdwarf', 'papi', 'pdt', 'ompt', 'libotf2', 'sqlite3', 'level_zero', 'zlib':
if uses(pkg):
self.add_dependency(pkg, sources)
if uses('scorep'):
Expand Down Expand Up @@ -627,6 +628,16 @@ def _verify_dependency_paths(self, tau_makefile):
LOGGER.debug("OTFINC='%s' != '%s'", libotf2_dir, libotf2.include_path)
raise SoftwarePackageError("OTFINC in '%s' is not '%s'" %
(tau_makefile, libotf2.include_path))
elif 'ZLIBINCLUDE=' in line:
if self.uses_zlib:
zlib = self.dependencies['zlib']
zlib_inc = shlex.split(line.split('=')[1])[0].strip('-I')
if not os.path.isdir(zlib_inc):
raise SoftwarePackageError("ZLIBINCLUDE in '%s' is not a directory" % tau_makefile)
if zlib.include_path != zlib_inc:
LOGGER.debug("ZLIBINCLUDE='%s' != '%s'", zlib_inc, zlib.include_path)
raise SoftwarePackageError("ZLIBINCLUDE in '%s' is not '%s'" %
(tau_makefile, zlib.include_path))
elif 'SQLITE3DIR=' in line:
if self.uses_sqlite3:
sqlite3 = self.dependencies['sqlite3']
Expand Down Expand Up @@ -772,6 +783,7 @@ def configure(self):
scorep = self.dependencies.get('scorep')
ompt = self.dependencies.get('ompt')
libotf2 = self.dependencies.get('libotf2')
zlib = self.dependencies.get('zlib')
sqlite3 = self.dependencies.get('sqlite3')
level_zero = self.dependencies.get('level_zero')

Expand All @@ -784,6 +796,7 @@ def configure(self):
'-bfd=%s' % binutils.install_prefix if binutils else None,
'-unwinder=%s' % self.unwinder,
'-unwind=%s' % libunwind.install_prefix if self.unwinder == 'libunwind' and libunwind else None,
'-zlib=%s' % zlib.install_prefix if zlib else None,
] if flag]
if util.create_subprocess(cmd, cwd=self._src_prefix, stdout=False, show_progress=True):
raise SoftwarePackageError('TAU configure failed')
Expand All @@ -808,6 +821,7 @@ def configure(self):
host_compilers.CRAY: 'cray',
host_compilers.IBM: 'ibm',
host_compilers.ARM: 'armflang',
host_compilers.NEC_SX: 'nfort',
host_compilers.IBM_BG: 'ibm'}
try:
fortran_magic = fc_magic_map[fc_family]
Expand Down Expand Up @@ -872,6 +886,7 @@ def configure(self):
'-dwarf=%s' % libdwarf.install_prefix if libdwarf else None,
'-elf=%s' % libelf.install_prefix if libdwarf else None,
'-scorep=%s' % scorep.install_prefix if scorep else None,
'-zlib=%s' %zlib.install_prefix if zlib else None,
'-tbb' if self.tbb_support else None,
'-mpi' if self.mpi_support else None,
'-mpiinc=%s' % mpiinc if mpiinc else None,
Expand Down Expand Up @@ -1585,7 +1600,10 @@ def get_application_command(self, launcher_cmd, application_cmds):
"to crash or produce invalid data. If you're unsure, use '--tau=download' when "
"creating your target to allow TAU Commander to manage your TAU configurations.",
makefile)
tau_exec = ['tau_exec', '-T', ','.join(tags)] + opts
if self.target_arch == NEC_SX:
tau_exec = [os.path.join(self.bin_path, 'tau_exec'), '-T', ','.join(tags)] + opts
else:
tau_exec = ['tau_exec', '-T', ','.join(tags)] + opts
if not application_cmds:
cmd = self._rewrite_launcher_appfile_cmd(launcher_cmd, tau_exec)
else:
Expand Down
64 changes: 64 additions & 0 deletions packages/taucmdr/cf/software/zlib_installation.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# -*- coding: utf-8 -*-
#
# Copyright (c) 2015, ParaTools, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# (1) Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# (2) Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
# (3) Neither the name of ParaTools, Inc. nor the names of its contributors may
# be used to endorse or promote products derived from this software without
# specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
"""Zlib software installation management.

Zlib is used by BFD for data compression.
"""

import os
import sys
import glob
import shutil
import fileinput
from taucmdr import logger, util
from taucmdr.error import ConfigurationError
from taucmdr.cf.software import SoftwarePackageError
from taucmdr.cf.software.installation import AutotoolsInstallation
from taucmdr.cf.compiler.host import CC, CXX, PGI, GNU


LOGGER = logger.get_logger(__name__)

REPOS = {None: 'https://www.zlib.net/zlib-1.2.11.tar.gz'}

LIBRARIES = {None: ['libz.a']}


class ZlibInstallation(AutotoolsInstallation):
"""Encapsulates a Zlib installation."""

def __init__(self, sources, target_arch, target_os, compilers):
super(ZlibInstallation, self).__init__('zlib', 'zlib', sources,
target_arch, target_os, compilers, REPOS, None, LIBRARIES, None)

def configure(self, flags):
os.environ['CC'] = self.compilers[CC].unwrap().absolute_path
return super(ZlibInstallation, self).configure(flags)

def make(self, flags):
super(ZlibInstallation, self).make(flags)
17 changes: 15 additions & 2 deletions packages/taucmdr/model/target.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
from taucmdr.model.compiler import Compiler
from taucmdr.cf import software
from taucmdr.cf.platforms import Architecture, OperatingSystem
from taucmdr.cf.platforms import HOST_ARCH, INTEL_KNC, HOST_OS, DARWIN, CRAY_CNL, PPC64LE
from taucmdr.cf.platforms import HOST_ARCH, INTEL_KNC, HOST_OS, DARWIN, CRAY_CNL, NEC_SX, PPC64LE
from taucmdr.cf.compiler import Knowledgebase, InstalledCompilerSet
from taucmdr.cf.storage.levels import PROJECT_STORAGE, SYSTEM_STORAGE

Expand Down Expand Up @@ -443,7 +443,8 @@ def attributes():
'group': 'software package',
'metavar': '(<path>|<url>|download|None)',
'action': ParsePackagePathAction},
'compat': {(lambda x: x is not None): Target.discourage('host_os', DARWIN)},
'compat': {(lambda x: x is not None): (Target.discourage('host_os', DARWIN),
Target.exclude('host_arch', NEC_SX))},
'rebuild_required': True
},
'libdwarf_source': {
Expand Down Expand Up @@ -515,6 +516,16 @@ def attributes():
'action': ParsePackagePathAction},
'rebuild_required': True
},
'zlib_source': {
'type': 'string',
'description': 'path or URL to zlib installation or archive file',
'default': 'download',
'argparse': {'flags': ('--zlib',),
'group': 'software package',
'metavar': '(<path>|<url>|download|None)',
'action': ParsePackagePathAction},
'rebuild_required': True
},
'sqlite3_source': {
'type': 'string',
'description': 'path or URL to SQLite3 installation or archive file',
Expand Down Expand Up @@ -635,6 +646,8 @@ def sources(self):
for attr, val in self.items():
if val and attr.endswith('_source'):
sources[attr.replace('_source', '')] = val
if sources['binutils']:
sources['zlib'] = sources['binutils']
return sources

def get_installation(self, name):
Expand Down