<commit_before>
# Copyright 2010-2012 University of Washington. All Rights Reserved.
# LICENSE_PLACEHOLDER
# This software was created with Government support under DE
# AC05-76RL01830 awarded by the United States Department of
# Energy. The Government has certain rights in the software.

#############################################################################
# common variables for grappa project
#
# many are defined with ?=, so they can be overridden at the top.
#############################################################################

# check if autodetect GRAPPA_HOME is consistent
AUTO_HOME=$(shell /bin/bash -c '(while [[ ! -e include.mk && "`pwd`" != "/" ]]; do cd ..; done; pwd )')
ifneq ($(GRAPPA_HOME), $(AUTO_HOME))
$(warning Environment variable GRAPPA_HOME was set but does not match the autodetected home. $(GRAPPA_HOME), $(AUTO_HOME))
endif

#
# common across machines
#
COMMON=../common
CFLAGS+= -I$(COMMON) -std=c++11 -Winline -Wno-inline

# TODO: verify that this is not a problem and remove:
CFLAGS+= -mno-red-zone

# TODO: see if we can make this apply to just our files, not user files or libraries
#CFLAGS+= -Wconversion

# TODO: clean up LD_LIBRARY_PATH to make this work better
CFLAGS+= -Wl,-rpath,$(LD_LIBRARY_PATH),--enable-new-dtags

# tcmalloc is disabled because it seems to slow message throughput down by 10% or so.
#### Enable tcmalloc by default, since we've already built its package for profiling
ifndef VALGRIND
#CFLAGS+=  -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free
#LIBRARIES+= -ltcmalloc
endif

LD_LIBRARY_PATH:=$(LD_LIBRARY_PATH):$(BOOST)/stage/lib

# CC=gcc
# CXX=g++
# LD=mpiCC

GCC472=/sampa/share/gcc-4.7.2/rtf
CC=$(GCC472)/bin/gcc
CXX=$(GCC472)/bin/g++
LD=$(GCC472)/bin/g++ -I/usr/include/openmpi-x86_64 -pthread -m64 -L/usr/lib64/openmpi/lib -lmpi_cxx -lmpi -ldl
GCC472_LD=$(GCC472)/bin/g++ -I/usr/include/openmpi-x86_64 -pthread -m64 -L/usr/lib64/openmpi/lib -lmpi_cxx -lmpi -ldl
LD_LIBRARY_PATH:=$(GCC472)/lib64:$(LD_LIBRARY_PATH)

NONE_CC=$(CC)
NONE_CXX=$(CXX)
NONE_LD=$(LD)


# define to build on PAL cluster
# should load modules:
#   module unload pathscale openmpi
#   module load git gcc/4.6.2 openmpi

MACHINENAME:=$(shell hostname)
ifeq ($(MACHINENAME), pal.local)
PAL=true
endif

ifdef PAL
NELSON=/pic/people/nels707

#GASNET=$(NELSON)/gasnet
HUGETLBFS=/usr
BOOST=$(NELSON)/boost
GPERFTOOLS=$(NELSON)/gperftools
VAMPIRTRACE=$(NELSON)/vampirtrace

MPITYPE=SRUN

SRUN_PARTITION=pal
SRUN_BUILD_PARTITION=pal
#SRUN_HOST=--partition $(SRUN_PARTITION) --account pal  --reservation=pal_25
SRUN_HOST=--partition $(SRUN_PARTITION) --account pal $(SRUN_RESERVE) --exclude=node0196
SRUN_RUN=salloc --exclusive $(SRUN_FLAGS) $($(MPITYPE)_HOST) $($(MPITYPE)_NPROC) $($(MPITYPE)_BATCH_TEMP)
SRUN_BUILD_CMD=
SRUN_CC=$(CC)
SRUN_CXX=$(CXX)
SRUN_LD=$(LD)
SRUN_AR=$(AR)

TEST_LIBS=-lboost_unit_test_framework

#CFLAGS+=-DHUGEPAGES_PER_MACHINE=32
# 32 GB of shared memory
SHMMAX=34359738368
endif

UNAME:=$(shell uname)

ifeq ($(UNAME), Darwin)
OSX=true
endif

ifdef OSX
#GASNET=/opt/grappa
#GFLAGS=/opt/grappa
#GLOG=/opt/grappa

BOOST=/usr/local
#GPERFTOOLS=/opt/grappa
#VAMPIRTRACE=/opt/grappa
MPITYPE=OPENMPI
HOST=localhost
GASNET_CONDUIT=mpi

SHMMAX=67108864
GASNET_SETTINGS+= GASNET_BACKTRACE=1
GASNET_SETTINGS+= GASNET_FREEZE_SIGNAL=SIGUSR1
GASNET_SETTINGS+= GASNET_FREEZE_ON_ERROR=1
GASNET_SETTINGS+= GASNET_FREEZE=0
#GASNET_SETTINGS+= GASNET_NETWORKDEPTH_PP=96
#GASNET_SETTINGS+= GASNET_NETWORKDEPTH_TOTAL=1024
#GASNET_SETTINGS+= GASNET_AMCREDITS_PP=48
#GASNET_SETTINGS+= GASNET_PHYSMEM_MAX=217M

PLATFORM_SPECIFIC_LIBS=
TEST_LIBS=-lboost_unit_test_framework-mt

NNODE=1
PPN?=2
endif

# check if we're running on ec2
# TODO: can we make this more robust?
ifeq ($(shell if [ -e /etc/ec2_version ]; then echo yes; fi), yes)
MPITYPE=SRUN
SHMMAX=$(shell sysctl kernel.shmmax | cut -d' ' -f3)

BOOST=/usr/local
TEST_LIBS=-lboost_unit_test_framework

SRUN_PARTITION=compute
SRUN_BUILD_PARTITION=compute
SRUN_HOST=--partition $(SRUN_PARTITION)
SRUN_BUILD_CMD=
SRUN_CC=$(CC)
SRUN_CXX=$(CXX)
SRUN_LD=$(LD)
SRUN_AR=$(AR)

CFLAGS+=-DUSE_HUGEPAGES_DEFAULT=false

# 
#EC2_UDP=true

ifdef EC2_UDP

GASNET_CONDUIT=udp
SRUN_MPIRUN?=srun --exclusive --label --kill-on-bad-exit $(SRUN_FLAGS)
SRUN_RUN=

# unfortunately running the epilog will require more configuration.
SRUN_EXPORT_ENV_VARIABLES=--task-prolog=$(SRUN_ENVVAR_TEMP)

GASNET_SETTINGS+=GASNET_SPAWNFN='C'
GASNET_SETTINGS+=GASNET_CSPAWN_CMD="$(SRUN_MPIRUN) $($(MPITYPE)_EXPORT_ENV_VARIABLES) $($(MPITYPE)_HOST) $($(MPITYPE)_NPROC) -- $(MY_TAU_RUN) \$$( echo '%C' | tr \\\" ' ' | cut -d' ' -f4,5,6 ) $(GARGS)"

# only defined for UDP spawners
SRUN_UDPTASKS=$(NPROC)

else

GASNET_CONDUIT=mpi
SRUN_RUN=salloc --exclusive $(SRUN_FLAGS) $($(MPITYPE)_HOST) $($(MPITYPE)_NPROC) $($(MPITYPE)_BATCH_TEMP)

endif

endif

PLATFORM_SPECIFIC_LIBS?=-lrt
TEST_LIBS?=-lboost_unit_test_framework

# (for Sampa cluster) 12 GB
SHMMAX?=12884901888

# some library paths
# defaults are for sampa cluster

# include this first to override system default if necessary
BOOST?=/sampa/share/gcc-4.7.2/src/boost_1_51_0
CFLAGS+= -I$(BOOST)
LDFLAGS+= -L$(BOOST)/stage/lib
LD_LIBRARY_PATH:=$(LD_LIBRARY_PATH):$(BOOST)/stage/lib

ifdef GASNET_TRACING
GASNET:=/sampa/share/gasnet-1.18.2-tracing
GASNET_SETTINGS+=GASNET_TRACEFILE="/scratch/gasnet_trace_%"
GASNET_SETTINGS+=GASNET_TRACEMASK=I
#GASNET_SETTINGS+=GASNET_TRACENODES=2-4
endif

# gasnet
GASNET=$(GRAPPA_HOME)/tools/built_deps
GASNET_CONDUIT?=ibv #values:ibv,mpi
GASNET_THREAD=seq #values:seq,par,parsync -- seq recommended

GASNET_CONDUIT_NS:=$(shell echo $(GASNET_CONDUIT)|tr -d " ")
GASNET_THREAD_NS:=$(shell echo $(GASNET_THREAD)|tr -d " ")
GASNET_LIBS+= -lgasnet-$(GASNET_CONDUIT_NS)-$(GASNET_THREAD_NS)
ifeq ($(GASNET_CONDUIT_NS),ibv)
GASNET_LIBS+= -libverbs
endif
ifeq ($(GASNET_CONDUIT_NS),mpi)
GASNET_LIBS+= -lammpi
endif
ifeq ($(GASNET_CONDUIT_NS),udp)
GASNET_LIBS+= -lamudp
endif
GASNET_FLAGS+= -DGASNET_$(shell echo $(GASNET_THREAD_NS) | tr a-z A-Z) -DGASNET_CONDUIT_$(shell echo $(GASNET_CONDUIT_NS) | tr a-z A-Z)<commit_msg>building on PAL changes to include.mk Other nodes: read include.mk for modules to load, don't use hugepages until enabled<commit_after>
# Copyright 2010-2012 University of Washington. All Rights Reserved.
# LICENSE_PLACEHOLDER
# This software was created with Government support under DE
# AC05-76RL01830 awarded by the United States Department of
# Energy. The Government has certain rights in the software.

#############################################################################
# common variables for grappa project
#
# many are defined with ?=, so they can be overridden at the top.
#############################################################################

# check if autodetect GRAPPA_HOME is consistent
AUTO_HOME=$(shell /bin/bash -c '(while [[ ! -e include.mk && "`pwd`" != "/" ]]; do cd ..; done; pwd )')
ifneq ($(GRAPPA_HOME), $(AUTO_HOME))
$(warning Environment variable GRAPPA_HOME was set but does not match the autodetected home. $(GRAPPA_HOME), $(AUTO_HOME))
endif

#
# common across machines
#
COMMON=../common
CFLAGS+= -I$(COMMON) -std=c++11 -Winline -Wno-inline

# TODO: verify that this is not a problem and remove:
CFLAGS+= -mno-red-zone

# TODO: see if we can make this apply to just our files, not user files or libraries
#CFLAGS+= -Wconversion

# TODO: clean up LD_LIBRARY_PATH to make this work better
CFLAGS+= -Wl,-rpath,$(LD_LIBRARY_PATH),--enable-new-dtags

# tcmalloc is disabled because it seems to slow message throughput down by 10% or so.
#### Enable tcmalloc by default, since we've already built its package for profiling
ifndef VALGRIND
#CFLAGS+=  -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free
#LIBRARIES+= -ltcmalloc
endif

LD_LIBRARY_PATH:=$(LD_LIBRARY_PATH):$(BOOST)/stage/lib

# CC=gcc
# CXX=g++
# LD=mpiCC

GCC472=/sampa/share/gcc-4.7.2/rtf
CC=$(GCC472)/bin/gcc
CXX=$(GCC472)/bin/g++
LD=$(GCC472)/bin/g++ -I/usr/include/openmpi-x86_64 -pthread -m64 -L/usr/lib64/openmpi/lib -lmpi_cxx -lmpi -ldl
GCC472_LD=$(GCC472)/bin/g++ -I/usr/include/openmpi-x86_64 -pthread -m64 -L/usr/lib64/openmpi/lib -lmpi_cxx -lmpi -ldl
LD_LIBRARY_PATH:=$(GCC472)/lib64:$(LD_LIBRARY_PATH)

NONE_CC=$(CC)
NONE_CXX=$(CXX)
NONE_LD=$(LD)


# to build on PAL cluster
# should load modules as follows:
#   module unload pathscale openmpi
#   module load git gcc/4.7.2 openmpi/1.6.3

MACHINENAME:=$(shell hostname)
ifeq ($(MACHINENAME), pal.local)
PAL=true
endif

ifdef PAL
NELSON=/pic/people/nels707

CC=gcc
CXX=g++
LD=mpiCC

#GASNET=$(NELSON)/gasnet
HUGETLBFS=/usr
BOOST=$(NELSON)/boost153-install
BOOST_INCLUDE=$(BOOST)/include
BOOST_LIB=$(BOOST)/lib
GPERFTOOLS=$(NELSON)/gperftools
VAMPIRTRACE=$(NELSON)/vampirtrace

MPITYPE=SRUN

SRUN_PARTITION=pal
SRUN_BUILD_PARTITION=pal
#SRUN_HOST=--partition $(SRUN_PARTITION) --account pal  --reservation=pal_25
SRUN_HOST=--partition $(SRUN_PARTITION) --account pal $(SRUN_RESERVE) --exclude=node0196
SRUN_RUN=salloc --exclusive $(SRUN_FLAGS) $($(MPITYPE)_HOST) $($(MPITYPE)_NPROC) $($(MPITYPE)_BATCH_TEMP)
SRUN_BUILD_CMD=
SRUN_CC=$(CC)
SRUN_CXX=$(CXX)
SRUN_LD=$(LD)
SRUN_AR=$(AR)

TEST_LIBS=-lboost_unit_test_framework

#CFLAGS+=-DHUGEPAGES_PER_MACHINE=32
# 32 GB of shared memory
SHMMAX=34359738368
endif

UNAME:=$(shell uname)

ifeq ($(UNAME), Darwin)
OSX=true
endif

ifdef OSX
#GASNET=/opt/grappa
#GFLAGS=/opt/grappa
#GLOG=/opt/grappa

BOOST=/usr/local
#GPERFTOOLS=/opt/grappa
#VAMPIRTRACE=/opt/grappa
MPITYPE=OPENMPI
HOST=localhost
GASNET_CONDUIT=mpi

SHMMAX=67108864
GASNET_SETTINGS+= GASNET_BACKTRACE=1
GASNET_SETTINGS+= GASNET_FREEZE_SIGNAL=SIGUSR1
GASNET_SETTINGS+= GASNET_FREEZE_ON_ERROR=1
GASNET_SETTINGS+= GASNET_FREEZE=0
#GASNET_SETTINGS+= GASNET_NETWORKDEPTH_PP=96
#GASNET_SETTINGS+= GASNET_NETWORKDEPTH_TOTAL=1024
#GASNET_SETTINGS+= GASNET_AMCREDITS_PP=48
#GASNET_SETTINGS+= GASNET_PHYSMEM_MAX=217M

PLATFORM_SPECIFIC_LIBS=
TEST_LIBS=-lboost_unit_test_framework-mt

NNODE=1
PPN?=2
endif

# check if we're running on ec2
# TODO: can we make this more robust?
ifeq ($(shell if [ -e /etc/ec2_version ]; then echo yes; fi), yes)
MPITYPE=SRUN
SHMMAX=$(shell sysctl kernel.shmmax | cut -d' ' -f3)

BOOST=/usr/local
TEST_LIBS=-lboost_unit_test_framework

SRUN_PARTITION=compute
SRUN_BUILD_PARTITION=compute
SRUN_HOST=--partition $(SRUN_PARTITION)
SRUN_BUILD_CMD=
SRUN_CC=$(CC)
SRUN_CXX=$(CXX)
SRUN_LD=$(LD)
SRUN_AR=$(AR)

CFLAGS+=-DUSE_HUGEPAGES_DEFAULT=false

# 
#EC2_UDP=true

ifdef EC2_UDP

GASNET_CONDUIT=udp
SRUN_MPIRUN?=srun --exclusive --label --kill-on-bad-exit $(SRUN_FLAGS)
SRUN_RUN=

# unfortunately running the epilog will require more configuration.
SRUN_EXPORT_ENV_VARIABLES=--task-prolog=$(SRUN_ENVVAR_TEMP)

GASNET_SETTINGS+=GASNET_SPAWNFN='C'
GASNET_SETTINGS+=GASNET_CSPAWN_CMD="$(SRUN_MPIRUN) $($(MPITYPE)_EXPORT_ENV_VARIABLES) $($(MPITYPE)_HOST) $($(MPITYPE)_NPROC) -- $(MY_TAU_RUN) \$$( echo '%C' | tr \\\" ' ' | cut -d' ' -f4,5,6 ) $(GARGS)"

# only defined for UDP spawners
SRUN_UDPTASKS=$(NPROC)

else

GASNET_CONDUIT=mpi
SRUN_RUN=salloc --exclusive $(SRUN_FLAGS) $($(MPITYPE)_HOST) $($(MPITYPE)_NPROC) $($(MPITYPE)_BATCH_TEMP)

endif

endif

PLATFORM_SPECIFIC_LIBS?=-lrt
TEST_LIBS?=-lboost_unit_test_framework

# (for Sampa cluster) 12 GB
SHMMAX?=12884901888

# some library paths
# defaults are for sampa cluster

# include this first to override system default if necessary
BOOST?=/sampa/share/gcc-4.7.2/src/boost_1_51_0
BOOST_INCLUDE?=$(BOOST)
BOOST_LIB?=$(BOOST)/stage/lib
CFLAGS+= -I$(BOOST_INCLUDE)
LDFLAGS+= -L$(BOOST_LIB)
LD_LIBRARY_PATH:=$(LD_LIBRARY_PATH):$(BOOST_LIB)

ifdef GASNET_TRACING
GASNET:=/sampa/share/gasnet-1.18.2-tracing
GASNET_SETTINGS+=GASNET_TRACEFILE="/scratch/gasnet_trace_%"
GASNET_SETTINGS+=GASNET_TRACEMASK=I
#GASNET_SETTINGS+=GASNET_TRACENODES=2-4
endif

# gasnet
GASNET=$(GRAPPA_HOME)/tools/built_deps
GASNET_CONDUIT?=ibv #values:ibv,mpi
GASNET_THREAD=seq #values:seq,par,parsync -- seq recommended

GASNET_CONDUIT_NS:=$(shell echo $(GASNET_CONDUIT)|tr -d " ")
GASNET_THREAD_NS:=$(shell echo $(GASNET_THREAD)|tr -d " ")
GASNET_LIBS+= -lgasnet-$(GASNET_CONDUIT_NS)-$(GASNET_THREAD_NS)
ifeq ($(GASNET_CONDUIT_NS),ibv)
GASNET_LIBS+= -libverbs
endif
ifeq ($(GASNET_CONDUIT_NS),mpi)
GASNET_LIBS+= -lammpi
endif
ifeq ($(GASNET_CONDUIT_NS),udp)
GASNET_LIBS+= -lamudp
endif
GASNET_FLAGS+= -DGASNET_$(shell echo $(GASNET_THREAD_NS) | tr a-z A-Z) -DGASNET_CONDUIT_$(shell echo $(GASNET_CONDUIT_NS) | tr a-z A-Z)
{'fraction_non_alphanumeric': 0.15960859801090793, 'fraction_numerical': 0.02438241899262111, 'mean_word_length': 6.430870083432658, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6379651', 'n_tokens_mistral': 5360, 'n_tokens_neox': 5011, 'n_words': 995}