-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Very much a skeleton of Main, Domain, CoarseScaleModel, FineScaleMode, and DBInterface.
- Loading branch information
0 parents
commit 539edf4
Showing
24 changed files
with
958 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
License (BSD) | ||
------------- | ||
|
||
Copyright (c) 2013, Los Alamos National Security, LLC | ||
All rights reserved. | ||
|
||
Copyright 2013. Los Alamos National Security, LLC. This software was produced under U.S. Government contract DE-AC52-06NA25396 for Los Alamos National Laboratory (LANL), which is operated by Los Alamos National Security, LLC for the U.S. Department of Energy. The U.S. Government has rights to use, reproduce, and distribute this software. NEITHER THE GOVERNMENT NOR LOS ALAMOS NATIONAL SECURITY, LLC MAKES ANY WARRANTY, EXPRESS OR IMPLIED, OR ASSUMES ANY LIABILITY FOR THE USE OF THIS SOFTWARE. If software is modified to produce derivative works, such modified software should be clearly marked, so as not to confuse it with the version available from LANL. | ||
|
||
Additionally, redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: | ||
|
||
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. | ||
|
||
* 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. | ||
|
||
* Neither the name of Los Alamos National Security, LLC, Los Alamos National Laboratory, LANL, the U.S. Government, 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 LOS ALAMOS NATIONAL SECURITY, LLC 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 LOS ALAMOS NATIONAL SECURITY, LLC 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. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
CoPPM | ||
========= | ||
CoPPM contains proxy examples of different Parallel Programming Models for applications | ||
such as CoEVP that are composed of a coarse scale model (ex. Lulesh) and a fine scale model. | ||
|
||
Copyright and license | ||
--------------------- | ||
|
||
Los Alamos National Security, LLC (LANS) owns the copyright to CoHMM, which it identifies as LA-CC-2012-065 (ExMatEx: Scale-Bridging Materials Evaluation and Test Suite, Version 1). The license is BSD-sh with a "modifications must be indicated" clause. See LICENSE.md for the full text. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
SRCDIR=src | ||
|
||
##############CHARM########## | ||
#CHARM_ROOT=/usr/projects/infmodels/smm/charm/charm-6.5.1 | ||
CHARMINC=$(CHARM_ROOT)/include/ | ||
ifeq (,$(CHARM_ROOT)) | ||
$(info Please establish Charmm++ environment variables before using this Makefile.) | ||
$(info E.g. by running setting CHARM_ROOT pr run 'module load charm++') | ||
$(error CHARM_ROOT is not set) | ||
endif | ||
CHARMBIN=$(CHARM_ROOT)/bin | ||
CXX=$(CHARMBIN)/charmc | ||
OBJDIR=charm_obj | ||
BINDIR=charm_bin | ||
|
||
#OPTFLAGS=-g | ||
OPTFLAGS=-O3 | ||
#other features | ||
#DEFS=-DTRACE | ||
|
||
ifneq ($(wildcard /usr/include/boost/foreach.hpp), ) | ||
BOOST_INCLUDES=/usr/include | ||
endif | ||
ifeq ($(BOOST_INCLUDES), ) | ||
$(error Set BOOST_INCLUDES or run 'module load boost' first) | ||
else | ||
BOOST_CFLAG=-I$(BOOST_INCLUDES) | ||
endif | ||
#We use boost header only so far | ||
BOOSTLIB=$(BOOST_INCLUDES)/../lib | ||
BOOST_LDFLAG=-L$(BOOSTLIB) | ||
|
||
#OBJS:=$(addprefix $(OBJDIR)/, CoPPM.o domain.o lulesh.o taylor.o output.o input.o main.o) | ||
OBJS:=$(addprefix $(OBJDIR)/, CoPPM.o Domain.o CoarseScaleModel.o FineScaleModel.o DBInterface.o input.o Main.o) | ||
CXXFLAGS+=$(OPTFLAGS) $(BOOST_CFLAG) $(DEFS) | ||
LDFLAGS= -lm -lrt | ||
|
||
#target | ||
NAME=$(BINDIR)/CoPPM | ||
default: all | ||
all: $(SUBDIRS) $(OBJDIR) $(NAME) | ||
|
||
$(OBJDIR)/%.d: $(SRCDIR)/%.cpp | ||
@#1. sed: put one file per line * * -> *\\\n* | ||
@#2. sed gcc -MG does not know that missing files will be in $(SRCDIR) | ||
@# no path -> SRCDIR | ||
@echo g++ -MM -MG -MT $(OBJDIR)/$*.o $(CXXFLAGS) -I$(SRCDIR) -I$(CHARMINC) $< \> $@ | ||
@g++ -MM -MG -MT $(OBJDIR)/$*.o $(CXXFLAGS) -I$(SRCDIR) -I$(CHARMINC) $< | \ | ||
sed 's/\([^[:space:]]\) \([^\\[:space:]]\)/\1 \\\n \2/g' | \ | ||
sed '/^[^/]*.\(def\|decl\)\./s@[^[:space:]]@$(SRCDIR)/&@' > $@ | ||
|
||
#Charmm++ ci files | ||
$(SRCDIR)/%.decl.h $(SRCDIR)/%.def.h: $(SRCDIR)/%.ci | ||
@#charmc writes to pwd only | ||
cd $(<D) && $(CXX) $(<F) | ||
|
||
DEPS=$(OBJS:.o=.d) | ||
ifneq "$(MAKECMDGOALS)" "clean" | ||
-include $(DEPS) | ||
endif | ||
|
||
#make subdirs for objects and executable | ||
$(NAME): | $(BINDIR) | ||
|
||
$(BINDIR): | ||
@mkdir -p $(BINDIR) | ||
|
||
$(OBJS): | $(OBJDIR) | ||
$(DEPS): | $(OBJDIR) | ||
|
||
$(OBJDIR): | ||
@mkdir -p $(OBJDIR) | ||
|
||
##--- Executable ---## | ||
|
||
$(NAME): $(OBJS) | ||
$(CXX) -o $@ $^ $(LDFLAGS) | ||
@mv charmrun $(BINDIR)/ | ||
|
||
#GNU make implicit rule | ||
$(OBJDIR)/%.o: $(SRCDIR)/%.cpp | ||
$(CXX) -c $(CXXFLAGS) $< -o $@ | ||
|
||
.PHONY: $(SUBDIRS) | ||
$(SUBDIRS): | ||
$(MAKE) $(MFLAGS) -C $@ | ||
|
||
subdirclean: | ||
@for i in $(SUBDIRS); do \ | ||
echo $(MAKE) $(MFLAGS) -C $$i clean; \ | ||
$(MAKE) $(MFLAGS) -C $$i clean || exit 1; \ | ||
done | ||
|
||
clean: subdirclean | ||
rm -f $(SRCDIR)/*.decl.h $(SRCDIR)/*.def.h $(OBJDIR)/charmrun | ||
rm -f *.vtk *.dat core.* | ||
rm -f $(OBJS) $(DEPS) $(NAME) $(OBJDIR)/main_*.[od] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{"parameter": { | ||
"header": "CoPPM Test Input File", | ||
"CoPPM": [ | ||
{"id": "domain", "value": "3D grid"}, | ||
{"id": "coarse scale model", "value": "lulesh"}, | ||
{"id": "fine scale model", "value": "Taylor Cylinder"}, | ||
{"id": "database interface", "value": "mtree"} | ||
], | ||
"domain": [ | ||
{"id": "dim x", "value": 50}, | ||
{"id": "dim y", "value": 50}, | ||
{"id": "dim z", "value": 50} | ||
], | ||
"coarse_scale": [ | ||
{"id": "integration steps", "value": 1000} | ||
], | ||
"fine_scale": [ | ||
{"id": "integration steps", "value": 1000} | ||
], | ||
"database_interface": [ | ||
{"id": "headnode", "value": "localhost"} | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{"parameter": { | ||
"header": "CoPPM Test Input File", | ||
"CoPPM": [ | ||
{"id": "domain", "value": "3D grid"} | ||
], | ||
"domain": [ | ||
{"id": "element dim x", "value": 50}, | ||
{"id": "element dim y", "value": 50}, | ||
{"id": "element dim z", "value": 50}, | ||
{"id": "block dim x", "value": 10}, | ||
{"id": "block dim y", "value": 10}, | ||
{"id": "block dim z", "value": 10} | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{"parameter": { | ||
"header": "CoPPM Test Input File", | ||
"CoPPM": [ | ||
{"id": "domain", "value": "3D grid"} | ||
], | ||
"Domain": [ | ||
{"id": "element dim x", "value": 4}, | ||
{"id": "element dim y", "value": 4}, | ||
{"id": "element dim z", "value": 4}, | ||
{"id": "block dim x", "value": 2}, | ||
{"id": "block dim y", "value": 2}, | ||
{"id": "block dim z", "value": 2} | ||
], | ||
"CoarseScaleModel": [ | ||
{"id": "type", "value": "Lulesh"}, | ||
{"id": "max timesteps", "value": "10"} | ||
], | ||
"FineScaleModel": [ | ||
{"id": "type", "value": "Taylor"} | ||
], | ||
"DBInterface": [ | ||
{"id": "type", "value": "mtree"} | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Load modules for darwin | ||
module load charm++ | ||
module load boost | ||
module load hiredis | ||
module load redis | ||
module list |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Run local | ||
./charm_bin/charmrun +p$1 charm_bin/CoPPM input/test2.json +stacksize 51200 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
mainmodule CoPPM { | ||
|
||
include "types.hpp"; | ||
|
||
readonly CProxy_Main mainProxy; // central controller | ||
readonly CProxy_Domain domainArray; // array of domains of elements | ||
readonly CProxy_CoarseScaleModel coarseScaleArray; // array of domain coarse scale models | ||
readonly CProxy_FineScaleModel fineScaleArray; // array of fine scale models | ||
readonly CProxy_DBInterface DBArray; // array of DB interfaces | ||
|
||
// Main driver | ||
mainchare Main { | ||
entry Main(CkArgMsg *msg); | ||
entry [threaded] void go(Input in); | ||
entry void done(); | ||
}; | ||
|
||
// Domains of elements | ||
array [3D] Domain { | ||
entry Domain(); | ||
entry void run(); | ||
}; | ||
|
||
// Coarse scale model - Lulesh | ||
array [3D] CoarseScaleModel { | ||
entry CoarseScaleModel(); | ||
entry void run(int ntimesteps, int nelems); | ||
}; | ||
|
||
// Fine scale model | ||
array [4D] FineScaleModel { | ||
entry FineScaleModel(); | ||
entry void run(int iter); | ||
}; | ||
|
||
// DB interface | ||
array [3D] DBInterface { | ||
entry DBInterface(); | ||
entry void run(); | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/****************C-STANDARDS**************/ | ||
#define _XOPEN_SOURCE 700 | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
#include <assert.h> | ||
#include <time.h> | ||
#include <string.h> | ||
#include <cfloat> | ||
#include <math.h> | ||
#include <string> | ||
#include <algorithm> | ||
#include <iostream> | ||
#include <ctime> | ||
/****************CPP-STANDARDS************/ | ||
#include <map> | ||
#include <vector> | ||
#include <list> | ||
/****************CHARM++******************/ | ||
#include "Main.hpp" | ||
#include "CoPPM.decl.h" | ||
#define printf CkPrintf | ||
/****************C-STUFF******************/ | ||
#include "types.hpp" | ||
/****************CPP-STUFF***************/ | ||
#include "CoPPM.hpp" | ||
#include "Domain.hpp" | ||
|
||
extern /* readonly */ CProxy_Main mainProxy; | ||
extern /* readonly */ CProxy_Domain domainArray; | ||
extern /* readonly */ CProxy_CoarseScaleModel coarseScaleArray; | ||
extern /* readonly */ CProxy_FineScaleModel fineScaleArray; | ||
extern /* readonly */ CProxy_DBInterface DBArray; | ||
|
||
void main_CoPPM(Input in, CProxy_Domain domainArray) | ||
{ | ||
printf("In main_CoPPM\n"); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#ifndef _COPPM_H_ | ||
#define _COPPM_H_ | ||
|
||
#include <math.h> | ||
#include <string.h> | ||
#include <string> | ||
|
||
#include "types.hpp" | ||
|
||
void main_CoPPM(Input in, CProxy_Domain domainArray); | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#include "CoPPM.decl.h" | ||
#include "CoarseScaleModel.hpp" | ||
#include "FineScaleModel.hpp" | ||
|
||
extern CProxy_Main mainProxy; | ||
extern CProxy_FineScaleModel fineScaleArray; | ||
|
||
CoarseScaleModel::CoarseScaleModel() | ||
{ | ||
|
||
printf("CoarseScaleModel created on PE %d Index %d %d %d\n", | ||
CkMyPe(), thisIndex.x, thisIndex.y, thisIndex.z); | ||
} | ||
|
||
CoarseScaleModel::CoarseScaleModel(CkMigrateMessage *msg) | ||
{ | ||
|
||
} | ||
|
||
CoarseScaleModel::~CoarseScaleModel() | ||
{ | ||
|
||
} | ||
|
||
void CoarseScaleModel::pup(PUP::er &p) | ||
{ | ||
|
||
} | ||
|
||
void CoarseScaleModel::run(int ntimesteps, int nelems) | ||
{ | ||
maxTimesteps = ntimesteps; | ||
numElems = nelems; | ||
//printf("CoarseScaleModel running\n"); | ||
|
||
for (int i = 0; i < maxTimesteps;i++) | ||
{ | ||
for (int j = 0; j < numElems; j++) | ||
{ | ||
fineScaleArray(thisIndex.x, thisIndex.y, thisIndex.z, j).run(i); | ||
} | ||
} | ||
|
||
// This chare is done | ||
//printf("CoarseScaleModel is done\n"); | ||
mainProxy.done(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#ifndef _COARSE_SCALE_MODEL_H_ | ||
#define _COARSE_SCALE_MODEL_H_ | ||
|
||
#include "CoPPM.decl.h" | ||
|
||
class CoarseScaleModel : public CBase_CoarseScaleModel { | ||
private: | ||
int maxTimesteps; | ||
int numElems; | ||
|
||
public: | ||
|
||
CoarseScaleModel(); | ||
CoarseScaleModel(CkMigrateMessage *msg); | ||
~CoarseScaleModel(); | ||
void pup(PUP::er &p); | ||
|
||
// Entry methods | ||
void run(int ntimesteps, int nelems); | ||
}; | ||
|
||
#endif |
Oops, something went wrong.