easyblock = 'ConfigureMake'

name = 'BerkeleyUPC'
version = '2.16.2'

homepage = 'http://upc.lbl.gov'
description = """The goal of the Berkeley UPC local_compiler group is to develop a portable,
high performance implementation of UPC for large-scale multiprocessors, PC clusters,
and clusters of shared memory multiprocessors.
"""

toolchain = {'name': 'gompi', 'version': '2015b'}

source_urls = [
    'http://upc.lbl.gov/download/release/'
]
sources = ['berkeley_upc-%(version)s.tar.gz']

preconfigopts = './Bootstrap -L && '
preconfigopts += 'export CFLAGS="$OPTFLAGS -fopenmp -Wl,-rpath,$EBROOTGCC/lib64" && '
# Manually create build directory
preconfigopts += 'mkdir build && cd build && '

# To be able run "../configure"
configure_cmd_prefix = "."

configopts = 'MPI_CC=$EBROOTOPENMPI/bin/mpicc --enable-sptr-symmetric --disable-aligned-segments '
configopts += '--enable-pshm --disable-pshm-posix --enable-pshm-sysv --enable-par --enable-udp '
configopts += '--enable-smp --enable-mpi --enable-ibv --with-default-network=smp --disable-shmem '

prebuildopts = 'cd build && '

preinstallopts = 'cd build && '

sanity_check_paths = {
    'files': ['bin/upcc_multi'],
    'dirs': ['bin', 'etc'],
}

parallel = 1

moduleclass = 'compiler'
