flecsi-skeleton 0.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- flecsi_skeleton-0.0.0/PKG-INFO +35 -0
- flecsi_skeleton-0.0.0/README.md +21 -0
- flecsi_skeleton-0.0.0/pyproject.toml +37 -0
- flecsi_skeleton-0.0.0/setup.cfg +4 -0
- flecsi_skeleton-0.0.0/src/flecsi_skeleton/__init__.py +0 -0
- flecsi_skeleton-0.0.0/src/flecsi_skeleton/__main__.py +7 -0
- flecsi_skeleton-0.0.0/src/flecsi_skeleton/_auxiliary_files/README.md +33 -0
- flecsi_skeleton-0.0.0/src/flecsi_skeleton/_auxiliary_files/support/env.yaml +11 -0
- flecsi_skeleton-0.0.0/src/flecsi_skeleton/_internal/fileutils.py +12 -0
- flecsi_skeleton-0.0.0/src/flecsi_skeleton/_internal/main.py +27 -0
- flecsi_skeleton-0.0.0/src/flecsi_skeleton/_internal/options.py +26 -0
- flecsi_skeleton-0.0.0/src/flecsi_skeleton/_internal/templates.py +346 -0
- flecsi_skeleton-0.0.0/src/flecsi_skeleton.egg-info/PKG-INFO +35 -0
- flecsi_skeleton-0.0.0/src/flecsi_skeleton.egg-info/SOURCES.txt +16 -0
- flecsi_skeleton-0.0.0/src/flecsi_skeleton.egg-info/dependency_links.txt +1 -0
- flecsi_skeleton-0.0.0/src/flecsi_skeleton.egg-info/entry_points.txt +2 -0
- flecsi_skeleton-0.0.0/src/flecsi_skeleton.egg-info/requires.txt +3 -0
- flecsi_skeleton-0.0.0/src/flecsi_skeleton.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: flecsi_skeleton
|
|
3
|
+
Version: 0.0.0
|
|
4
|
+
Summary: Generate skeleton FleCSI-based application projects.
|
|
5
|
+
Author-email: Ben Bergen <bergen@lanl.gov>
|
|
6
|
+
License-Expression: BSD-3-Clause
|
|
7
|
+
Project-URL: Homepage, https://flecsi.org
|
|
8
|
+
Project-URL: Source, https://github.com/flecsi/flecsi
|
|
9
|
+
Project-URL: Issues, https://github.com/flecsi/flecsi/issues
|
|
10
|
+
Requires-Python: >=3.9
|
|
11
|
+
Description-Content-Type: text/markdown
|
|
12
|
+
Provides-Extra: dev
|
|
13
|
+
Requires-Dist: pytest>=7; extra == "dev"
|
|
14
|
+
|
|
15
|
+
# FleCSI Skeleton Package (skelf)
|
|
16
|
+
|
|
17
|
+
## Create Python Environment
|
|
18
|
+
|
|
19
|
+
The best way to build this package for development is to create a python
|
|
20
|
+
environment:
|
|
21
|
+
```shell
|
|
22
|
+
$ python -m venv --prompt skelf-devel .venv
|
|
23
|
+
$ source .venv/bin/activate
|
|
24
|
+
$ pip install build twine
|
|
25
|
+
```
|
|
26
|
+
Then you can build like:
|
|
27
|
+
```shell
|
|
28
|
+
$ pip install -ve .
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Publish
|
|
32
|
+
|
|
33
|
+
```shell
|
|
34
|
+
$ twine upload dist/*
|
|
35
|
+
```
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# FleCSI Skeleton Package (skelf)
|
|
2
|
+
|
|
3
|
+
## Create Python Environment
|
|
4
|
+
|
|
5
|
+
The best way to build this package for development is to create a python
|
|
6
|
+
environment:
|
|
7
|
+
```shell
|
|
8
|
+
$ python -m venv --prompt skelf-devel .venv
|
|
9
|
+
$ source .venv/bin/activate
|
|
10
|
+
$ pip install build twine
|
|
11
|
+
```
|
|
12
|
+
Then you can build like:
|
|
13
|
+
```shell
|
|
14
|
+
$ pip install -ve .
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Publish
|
|
18
|
+
|
|
19
|
+
```shell
|
|
20
|
+
$ twine upload dist/*
|
|
21
|
+
```
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=68", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "flecsi_skeleton"
|
|
7
|
+
version = "0.0.0"
|
|
8
|
+
description = "Generate skeleton FleCSI-based application projects."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.9"
|
|
11
|
+
license = "BSD-3-Clause"
|
|
12
|
+
authors = [{ name = "Ben Bergen", email = "bergen@lanl.gov"}]
|
|
13
|
+
|
|
14
|
+
[project.scripts]
|
|
15
|
+
skelf = "flecsi_skeleton._internal.main:main"
|
|
16
|
+
|
|
17
|
+
[project.urls]
|
|
18
|
+
Homepage = "https://flecsi.org"
|
|
19
|
+
Source = "https://github.com/flecsi/flecsi"
|
|
20
|
+
Issues = "https://github.com/flecsi/flecsi/issues"
|
|
21
|
+
|
|
22
|
+
[project.optional-dependencies]
|
|
23
|
+
dev = ["pytest>=7"]
|
|
24
|
+
|
|
25
|
+
[tool.setuptools]
|
|
26
|
+
package-dir = {"" = "src"}
|
|
27
|
+
|
|
28
|
+
[tool.setuptools.packages.find]
|
|
29
|
+
where = ["src"]
|
|
30
|
+
|
|
31
|
+
[tool.setuptools.package-data]
|
|
32
|
+
"flecsi_skeleton" = [
|
|
33
|
+
"_auxiliary_files/README.md",
|
|
34
|
+
"_auxiliary_files/app/*",
|
|
35
|
+
"_auxiliary_files/spec/*",
|
|
36
|
+
"_auxiliary_files/support/*"
|
|
37
|
+
]
|
|
File without changes
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# FleCSI Sandbox
|
|
2
|
+
|
|
3
|
+
This skeleton project will get you started with building and running a
|
|
4
|
+
FleCSI-based application.
|
|
5
|
+
|
|
6
|
+
# Spack Environment
|
|
7
|
+
|
|
8
|
+
Spack is the easiest way to build and run this example. You can install spack
|
|
9
|
+
following the instructions
|
|
10
|
+
[here](https://spack.readthedocs.io/en/latest/getting_started.html). Once you
|
|
11
|
+
have sourced the appropriate script for your shell, you can create a spack
|
|
12
|
+
environment like:
|
|
13
|
+
|
|
14
|
+
```shell
|
|
15
|
+
$ spack env create flecsi support/env.yaml
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
The contents of _env.yaml_ are similar to this content, which configures FleCSI
|
|
19
|
+
with the Legion backend:
|
|
20
|
+
|
|
21
|
+
```yaml
|
|
22
|
+
spack:
|
|
23
|
+
specs:
|
|
24
|
+
- flecsi
|
|
25
|
+
packages:
|
|
26
|
+
flecsi:
|
|
27
|
+
require: '@2 +flog +graphviz +hdf5 backend=legion build_type=Debug'
|
|
28
|
+
legion:
|
|
29
|
+
require: 'network=gasnet conduit=mpi'
|
|
30
|
+
view: true
|
|
31
|
+
concretizer:
|
|
32
|
+
unify: true
|
|
33
|
+
```
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
from pathlib import Path
|
|
2
|
+
from importlib.resources import files
|
|
3
|
+
import textwrap
|
|
4
|
+
|
|
5
|
+
def write(path: Path, content: str):
|
|
6
|
+
path.parent.mkdir(parents=True, exist_ok=True)
|
|
7
|
+
path.write_text(textwrap.dedent(content), encoding="utf-8")
|
|
8
|
+
|
|
9
|
+
def copy_resource(src: str, dest: Path):
|
|
10
|
+
dest.parent.mkdir(parents=True, exist_ok=True)
|
|
11
|
+
content = files('flecsi_skeleton._auxiliary_files').joinpath(src).read_text()
|
|
12
|
+
write(dest / src, content)
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import sys
|
|
2
|
+
from .options import *
|
|
3
|
+
from .fileutils import *
|
|
4
|
+
from .templates import *
|
|
5
|
+
|
|
6
|
+
#-------------------------------------------------------------------------------#
|
|
7
|
+
# Main
|
|
8
|
+
#-------------------------------------------------------------------------------#
|
|
9
|
+
|
|
10
|
+
def main():
|
|
11
|
+
args, dargs = parse_args()
|
|
12
|
+
|
|
13
|
+
write(args.root / 'CMakeLists.txt', TOPLEVEL_CMAKELISTS.format(**dargs))
|
|
14
|
+
write(args.root / 'spec' / 'CMakeLists.txt', SPEC_CMAKELISTS.format(**dargs))
|
|
15
|
+
write(args.root / 'app' / 'CMakeLists.txt', APP_CMAKELISTS.format(**dargs))
|
|
16
|
+
|
|
17
|
+
write(args.root / 'spec' / 'control.hh', CONTROL.format(**dargs))
|
|
18
|
+
|
|
19
|
+
write(args.root / 'app' / (args.name + '.cc'), DRIVER.format(**dargs))
|
|
20
|
+
write(args.root / 'app' / 'advance.hh', ADVANCE.format(**dargs))
|
|
21
|
+
write(args.root / 'app' / 'analyze.hh', ANALYZE.format(**dargs))
|
|
22
|
+
write(args.root / 'app' / 'finalize.hh', FINALIZE.format(**dargs))
|
|
23
|
+
write(args.root / 'app' / 'initialize.hh', INITIALIZE.format(**dargs))
|
|
24
|
+
write(args.root / 'app' / 'types.hh', TYPES.format(**dargs))
|
|
25
|
+
|
|
26
|
+
copy_resource('README.md', args.root)
|
|
27
|
+
copy_resource('support/env.yaml', args.root)
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
from pathlib import Path
|
|
2
|
+
import argparse
|
|
3
|
+
|
|
4
|
+
#-------------------------------------------------------------------------------#
|
|
5
|
+
# Command line arguments
|
|
6
|
+
#-------------------------------------------------------------------------------#
|
|
7
|
+
|
|
8
|
+
argParser = argparse.ArgumentParser()
|
|
9
|
+
argParser.add_argument('name', help="the name of the project")
|
|
10
|
+
argParser.add_argument('-p', '--path', action='store', dest='path',
|
|
11
|
+
help="specify a path to the project"
|
|
12
|
+
" default: current directory")
|
|
13
|
+
|
|
14
|
+
def parse_args():
|
|
15
|
+
args = argParser.parse_args()
|
|
16
|
+
|
|
17
|
+
root = Path(args.path + '/' + args.name) if args.path else Path(args.name)
|
|
18
|
+
|
|
19
|
+
# Use argparse Namespace so that access can be like args.root
|
|
20
|
+
return argparse.Namespace(root = root, name = args.name), \
|
|
21
|
+
{
|
|
22
|
+
"ROOT" : root,
|
|
23
|
+
"UCC_APPNAME" : args.name.title(),
|
|
24
|
+
"LC_APPNAME" : args.name.lower(),
|
|
25
|
+
"UC_APPNAME" : args.name.upper()
|
|
26
|
+
}
|
|
@@ -0,0 +1,346 @@
|
|
|
1
|
+
#################################################################################
|
|
2
|
+
# CMakeLists
|
|
3
|
+
#################################################################################
|
|
4
|
+
|
|
5
|
+
#-------------------------------------------------------------------------------#
|
|
6
|
+
# Top-Level CMakeLists.txt
|
|
7
|
+
#-------------------------------------------------------------------------------#
|
|
8
|
+
|
|
9
|
+
TOPLEVEL_CMAKELISTS = """\
|
|
10
|
+
#-------------------------------------------------------------------------------#
|
|
11
|
+
# Top-Level CMakeLists.txt
|
|
12
|
+
#-------------------------------------------------------------------------------#
|
|
13
|
+
|
|
14
|
+
cmake_minimum_required(VERSION 3.20)
|
|
15
|
+
|
|
16
|
+
project({UCC_APPNAME} LANGUAGES C CXX)
|
|
17
|
+
|
|
18
|
+
set(CMAKE_STANDARD_REQUIRED ON)
|
|
19
|
+
set(CMAKE_CXX_STANDARD 20)
|
|
20
|
+
set(CMAKE_CXX_EXTENSIONS OFF)
|
|
21
|
+
|
|
22
|
+
#-------------------------------------------------------------------------------#
|
|
23
|
+
# Find FleCSI package.
|
|
24
|
+
#-------------------------------------------------------------------------------#
|
|
25
|
+
|
|
26
|
+
find_package(FleCSI 2 REQUIRED)
|
|
27
|
+
|
|
28
|
+
#-------------------------------------------------------------------------------#
|
|
29
|
+
# Add library.
|
|
30
|
+
#-------------------------------------------------------------------------------#
|
|
31
|
+
|
|
32
|
+
set(SPEC_TARGET "${{CMAKE_PROJECT_NAME}}-Spec")
|
|
33
|
+
add_library(${{SPEC_TARGET}} INTERFACE)
|
|
34
|
+
add_library(${{SPEC_TARGET}}::${{SPEC_TARGET}} ALIAS ${{SPEC_TARGET}})
|
|
35
|
+
target_include_directories(${{SPEC_TARGET}}
|
|
36
|
+
INTERFACE
|
|
37
|
+
$<BUILD_INTERFACE:${{CMAKE_CURRENT_SOURCE_DIR}}>
|
|
38
|
+
$<BUILD_INTERFACE:${{CMAKE_BINARY_DIR}}>
|
|
39
|
+
$<INSTALL_INTERFACE:${{CMAKE_INSTALL_INCLUDEDIR}}>
|
|
40
|
+
)
|
|
41
|
+
add_subdirectory(spec)
|
|
42
|
+
|
|
43
|
+
#-------------------------------------------------------------------------------#
|
|
44
|
+
# Add application.
|
|
45
|
+
#-------------------------------------------------------------------------------#
|
|
46
|
+
|
|
47
|
+
add_subdirectory(app)
|
|
48
|
+
"""
|
|
49
|
+
|
|
50
|
+
#-------------------------------------------------------------------------------#
|
|
51
|
+
# Specialization CMakeLists.txt
|
|
52
|
+
#-------------------------------------------------------------------------------#
|
|
53
|
+
|
|
54
|
+
SPEC_CMAKELISTS = """\
|
|
55
|
+
#-------------------------------------------------------------------------------#
|
|
56
|
+
# Specialization CMakeLists.txt
|
|
57
|
+
#-------------------------------------------------------------------------------#
|
|
58
|
+
|
|
59
|
+
function(spec_headers)
|
|
60
|
+
target_sources(${{SPEC_TARGET}} PUBLIC FILE_SET public_headers TYPE HEADERS
|
|
61
|
+
BASE_DIRS ${{CMAKE_SOURCE_DIR}} FILES ${{ARGN}})
|
|
62
|
+
endfunction()
|
|
63
|
+
|
|
64
|
+
spec_headers(
|
|
65
|
+
control.hh
|
|
66
|
+
)
|
|
67
|
+
"""
|
|
68
|
+
|
|
69
|
+
#-------------------------------------------------------------------------------#
|
|
70
|
+
# Application CMakeLists.txt
|
|
71
|
+
#-------------------------------------------------------------------------------#
|
|
72
|
+
|
|
73
|
+
APP_CMAKELISTS = """\
|
|
74
|
+
#-------------------------------------------------------------------------------#
|
|
75
|
+
# {UCC_APPNAME} CMakeLists.txt
|
|
76
|
+
#-------------------------------------------------------------------------------#
|
|
77
|
+
|
|
78
|
+
option({UC_APPNAME}_WRITE_CONTROL_INFO
|
|
79
|
+
"Output the control model graph and actions at startup"
|
|
80
|
+
FleCSI_ENABLE_GRAPHVIZ)
|
|
81
|
+
mark_as_advanced({UC_APPNAME}_WRITE_CONTROL_INFO)
|
|
82
|
+
|
|
83
|
+
add_executable({LC_APPNAME} {LC_APPNAME}.cc)
|
|
84
|
+
target_link_libraries({LC_APPNAME} ${{SPEC_TARGET}}::${{SPEC_TARGET}} FleCSI::FleCSI)
|
|
85
|
+
|
|
86
|
+
if(FleCSI_ENABLE_GRAPHVIZ AND {UC_APPNAME}_WRITE_CONTROL_INFO)
|
|
87
|
+
target_compile_definitions({LC_APPNAME} PUBLIC {UC_APPNAME}_WRITE_CONTROL_INFO)
|
|
88
|
+
elseif(NOT FleCSI_ENABLE_GRAPHVIZ AND {UC_APPNAME}_WRITE_CONTROL_INFO)
|
|
89
|
+
message(WARNING,
|
|
90
|
+
"{UC_APPNAME}_WRITE_CONTROL_INFO enabled but FleCSI not compiled with Graphviz")
|
|
91
|
+
endif()
|
|
92
|
+
"""
|
|
93
|
+
|
|
94
|
+
#################################################################################
|
|
95
|
+
# Specialization source
|
|
96
|
+
#################################################################################
|
|
97
|
+
|
|
98
|
+
#-------------------------------------------------------------------------------#
|
|
99
|
+
# Control Model
|
|
100
|
+
#-------------------------------------------------------------------------------#
|
|
101
|
+
|
|
102
|
+
CONTROL = """\
|
|
103
|
+
#ifndef SPEC_CONTROL_HH
|
|
104
|
+
#define SPEC_CONTROL_HH
|
|
105
|
+
|
|
106
|
+
#include <flecsi/flog.hh>
|
|
107
|
+
#include <flecsi/run/control.hh>
|
|
108
|
+
|
|
109
|
+
namespace spec::control {{
|
|
110
|
+
/// Control Points.
|
|
111
|
+
enum class cp {{
|
|
112
|
+
/// Application initialization.
|
|
113
|
+
initialize,
|
|
114
|
+
/// Time evolution (cycled).
|
|
115
|
+
advance,
|
|
116
|
+
/// Running analysis (cycled).
|
|
117
|
+
analyze,
|
|
118
|
+
/// Application finalization.
|
|
119
|
+
finalize
|
|
120
|
+
}};
|
|
121
|
+
|
|
122
|
+
inline const char *
|
|
123
|
+
operator*(cp control_point) {{
|
|
124
|
+
switch(control_point) {{
|
|
125
|
+
case cp::initialize:
|
|
126
|
+
return "initialize";
|
|
127
|
+
case cp::advance:
|
|
128
|
+
return "advance";
|
|
129
|
+
case cp::analyze:
|
|
130
|
+
return "analyze";
|
|
131
|
+
case cp::finalize:
|
|
132
|
+
return "finalize";
|
|
133
|
+
}}
|
|
134
|
+
flog_fatal("invalid control point");
|
|
135
|
+
}}
|
|
136
|
+
|
|
137
|
+
struct control_policy : flecsi::run::control_base {{
|
|
138
|
+
|
|
139
|
+
using control_points_enum = cp;
|
|
140
|
+
|
|
141
|
+
/// Control Model Constructor
|
|
142
|
+
/// @param steps Maximum number of time steps.
|
|
143
|
+
/// @param log Logging frequency.
|
|
144
|
+
control_policy(std::size_t steps, std::size_t log)
|
|
145
|
+
: steps_(steps), log_(log) {{}}
|
|
146
|
+
|
|
147
|
+
auto step() const {{ return step_; }}
|
|
148
|
+
auto steps() const {{ return steps_; }}
|
|
149
|
+
auto log() const {{ return log_; }}
|
|
150
|
+
|
|
151
|
+
static bool cycle_control(control_policy & cp) {{
|
|
152
|
+
return cp.step_++ < cp.steps_;
|
|
153
|
+
}}
|
|
154
|
+
|
|
155
|
+
using evolve = cycle<cycle_control, point<cp::advance>, point<cp::analyze>>;
|
|
156
|
+
|
|
157
|
+
using control_points =
|
|
158
|
+
list<point<cp::initialize>, evolve, point<cp::finalize>>;
|
|
159
|
+
|
|
160
|
+
protected:
|
|
161
|
+
std::size_t step_{{0}};
|
|
162
|
+
std::size_t steps_;
|
|
163
|
+
std::size_t log_;
|
|
164
|
+
}};
|
|
165
|
+
}}
|
|
166
|
+
|
|
167
|
+
#endif // SPEC_CONTROL_HH
|
|
168
|
+
"""
|
|
169
|
+
|
|
170
|
+
#################################################################################
|
|
171
|
+
# Application source
|
|
172
|
+
#################################################################################
|
|
173
|
+
|
|
174
|
+
#-------------------------------------------------------------------------------#
|
|
175
|
+
# Driver
|
|
176
|
+
#-------------------------------------------------------------------------------#
|
|
177
|
+
|
|
178
|
+
DRIVER = """\
|
|
179
|
+
/*-----------------------------------------------------------------------------*
|
|
180
|
+
Driver (main function)
|
|
181
|
+
*-----------------------------------------------------------------------------*/
|
|
182
|
+
|
|
183
|
+
// These import the action definitions.
|
|
184
|
+
#include "advance.hh"
|
|
185
|
+
#include "analyze.hh"
|
|
186
|
+
#include "initialize.hh"
|
|
187
|
+
#include "finalize.hh"
|
|
188
|
+
|
|
189
|
+
/*
|
|
190
|
+
Headers are ordered by decreasing locality, e.g., directory, project,
|
|
191
|
+
library dependency, standard library.
|
|
192
|
+
*/
|
|
193
|
+
#include "types.hh"
|
|
194
|
+
|
|
195
|
+
#include <spec/control.hh>
|
|
196
|
+
|
|
197
|
+
#include <flecsi/runtime.hh>
|
|
198
|
+
|
|
199
|
+
using namespace flecsi;
|
|
200
|
+
|
|
201
|
+
int
|
|
202
|
+
main(int argc, char ** argv) {{
|
|
203
|
+
// Output control model information.
|
|
204
|
+
#if defined({UC_APPNAME}_WRITE_CONTROL_INFO)
|
|
205
|
+
{LC_APPNAME}::control::write_graph("{UC_APPNAME}", "cm.dot");
|
|
206
|
+
{LC_APPNAME}::control::write_actions("{UC_APPNAME}", "actions.dot");
|
|
207
|
+
#endif
|
|
208
|
+
|
|
209
|
+
const flecsi::getopt g;
|
|
210
|
+
try {{
|
|
211
|
+
g(argc, argv);
|
|
212
|
+
}}
|
|
213
|
+
catch(const std::logic_error & e) {{
|
|
214
|
+
std::cerr << e.what() << ' ' << g.usage(argc ? argv[0] : "");
|
|
215
|
+
return 1;
|
|
216
|
+
}}
|
|
217
|
+
|
|
218
|
+
const run::dependencies_guard dg;
|
|
219
|
+
run::config cfg;
|
|
220
|
+
|
|
221
|
+
runtime run(cfg);
|
|
222
|
+
flog::add_output_stream("clog", std::clog, true);
|
|
223
|
+
run.control<{LC_APPNAME}::control>(10, 1);
|
|
224
|
+
}}
|
|
225
|
+
"""
|
|
226
|
+
|
|
227
|
+
#-------------------------------------------------------------------------------#
|
|
228
|
+
# Advance
|
|
229
|
+
#-------------------------------------------------------------------------------#
|
|
230
|
+
|
|
231
|
+
ADVANCE = """\
|
|
232
|
+
#ifndef {UC_APPNAME}_ADVANCE_HH
|
|
233
|
+
#define {UC_APPNAME}_ADVANCE_HH
|
|
234
|
+
|
|
235
|
+
#include "types.hh"
|
|
236
|
+
|
|
237
|
+
#include <flecsi/flog.hh>
|
|
238
|
+
|
|
239
|
+
namespace {LC_APPNAME}::action {{
|
|
240
|
+
|
|
241
|
+
void
|
|
242
|
+
advance(control_policy & cp) {{
|
|
243
|
+
flog(info) << "Advance Action: " << cp.step() << std::endl;
|
|
244
|
+
}}
|
|
245
|
+
|
|
246
|
+
inline control::action<advance, cp::advance> advance_action;
|
|
247
|
+
}}
|
|
248
|
+
|
|
249
|
+
#endif // {UC_APPNAME}_ADVANCE_HH
|
|
250
|
+
"""
|
|
251
|
+
|
|
252
|
+
#-------------------------------------------------------------------------------#
|
|
253
|
+
# Analyze
|
|
254
|
+
#-------------------------------------------------------------------------------#
|
|
255
|
+
|
|
256
|
+
ANALYZE = """\
|
|
257
|
+
#ifndef {UC_APPNAME}_ANALYZE_HH
|
|
258
|
+
#define {UC_APPNAME}_ANALYZE_HH
|
|
259
|
+
|
|
260
|
+
#include "types.hh"
|
|
261
|
+
|
|
262
|
+
#include <flecsi/flog.hh>
|
|
263
|
+
|
|
264
|
+
namespace {LC_APPNAME}::action {{
|
|
265
|
+
|
|
266
|
+
void
|
|
267
|
+
analyze(control_policy & cp) {{
|
|
268
|
+
flog(info) << "Analyze Action: " << cp.step() << std::endl;
|
|
269
|
+
}}
|
|
270
|
+
|
|
271
|
+
inline control::action<analyze, cp::analyze> analyze_action;
|
|
272
|
+
}}
|
|
273
|
+
|
|
274
|
+
#endif // {UC_APPNAME}_ANALYZE_HH
|
|
275
|
+
"""
|
|
276
|
+
|
|
277
|
+
#-------------------------------------------------------------------------------#
|
|
278
|
+
# Finalize
|
|
279
|
+
#-------------------------------------------------------------------------------#
|
|
280
|
+
|
|
281
|
+
FINALIZE = """\
|
|
282
|
+
#ifndef {UC_APPNAME}_FINALIZE_HH
|
|
283
|
+
#define {UC_APPNAME}_FINALIZE_HH
|
|
284
|
+
|
|
285
|
+
#include "types.hh"
|
|
286
|
+
|
|
287
|
+
#include <flecsi/flog.hh>
|
|
288
|
+
|
|
289
|
+
namespace {LC_APPNAME}::action {{
|
|
290
|
+
|
|
291
|
+
void
|
|
292
|
+
finalize(control_policy & cp) {{
|
|
293
|
+
flog(info) << "Finalize Action" << std::endl;
|
|
294
|
+
}}
|
|
295
|
+
|
|
296
|
+
inline control::action<finalize, cp::finalize> final_action;
|
|
297
|
+
}}
|
|
298
|
+
|
|
299
|
+
#endif // {UC_APPNAME}_FINALIZE_HH
|
|
300
|
+
"""
|
|
301
|
+
|
|
302
|
+
#-------------------------------------------------------------------------------#
|
|
303
|
+
# Initialize
|
|
304
|
+
#-------------------------------------------------------------------------------#
|
|
305
|
+
|
|
306
|
+
INITIALIZE = """\
|
|
307
|
+
#ifndef {UC_APPNAME}_INITIALIZE_HH
|
|
308
|
+
#define {UC_APPNAME}_INITIALIZE_HH
|
|
309
|
+
|
|
310
|
+
#include "types.hh"
|
|
311
|
+
|
|
312
|
+
#include <flecsi/flog.hh>
|
|
313
|
+
|
|
314
|
+
namespace {LC_APPNAME}::action {{
|
|
315
|
+
|
|
316
|
+
void
|
|
317
|
+
initialize(control_policy & cp) {{
|
|
318
|
+
flog(info) << "Initialize Action" << std::endl;
|
|
319
|
+
}}
|
|
320
|
+
|
|
321
|
+
inline control::action<initialize, cp::initialize> init_action;
|
|
322
|
+
}}
|
|
323
|
+
|
|
324
|
+
#endif // {UC_APPNAME}_INITIALIZE_HH
|
|
325
|
+
"""
|
|
326
|
+
|
|
327
|
+
#-------------------------------------------------------------------------------#
|
|
328
|
+
# Types
|
|
329
|
+
#-------------------------------------------------------------------------------#
|
|
330
|
+
|
|
331
|
+
TYPES = """\
|
|
332
|
+
#ifndef {UC_APPNAME}_TYPES_HH
|
|
333
|
+
#define {UC_APPNAME}_TYPES_HH
|
|
334
|
+
|
|
335
|
+
#include <spec/control.hh>
|
|
336
|
+
|
|
337
|
+
namespace {LC_APPNAME} {{
|
|
338
|
+
|
|
339
|
+
using spec::control::control_policy;
|
|
340
|
+
using control = flecsi::run::control<control_policy>;
|
|
341
|
+
using cp = spec::control::cp;
|
|
342
|
+
|
|
343
|
+
}}
|
|
344
|
+
|
|
345
|
+
#endif // {UC_APPNAME}_TYPES_HH
|
|
346
|
+
"""
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: flecsi_skeleton
|
|
3
|
+
Version: 0.0.0
|
|
4
|
+
Summary: Generate skeleton FleCSI-based application projects.
|
|
5
|
+
Author-email: Ben Bergen <bergen@lanl.gov>
|
|
6
|
+
License-Expression: BSD-3-Clause
|
|
7
|
+
Project-URL: Homepage, https://flecsi.org
|
|
8
|
+
Project-URL: Source, https://github.com/flecsi/flecsi
|
|
9
|
+
Project-URL: Issues, https://github.com/flecsi/flecsi/issues
|
|
10
|
+
Requires-Python: >=3.9
|
|
11
|
+
Description-Content-Type: text/markdown
|
|
12
|
+
Provides-Extra: dev
|
|
13
|
+
Requires-Dist: pytest>=7; extra == "dev"
|
|
14
|
+
|
|
15
|
+
# FleCSI Skeleton Package (skelf)
|
|
16
|
+
|
|
17
|
+
## Create Python Environment
|
|
18
|
+
|
|
19
|
+
The best way to build this package for development is to create a python
|
|
20
|
+
environment:
|
|
21
|
+
```shell
|
|
22
|
+
$ python -m venv --prompt skelf-devel .venv
|
|
23
|
+
$ source .venv/bin/activate
|
|
24
|
+
$ pip install build twine
|
|
25
|
+
```
|
|
26
|
+
Then you can build like:
|
|
27
|
+
```shell
|
|
28
|
+
$ pip install -ve .
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Publish
|
|
32
|
+
|
|
33
|
+
```shell
|
|
34
|
+
$ twine upload dist/*
|
|
35
|
+
```
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
README.md
|
|
2
|
+
pyproject.toml
|
|
3
|
+
src/flecsi_skeleton/__init__.py
|
|
4
|
+
src/flecsi_skeleton/__main__.py
|
|
5
|
+
src/flecsi_skeleton.egg-info/PKG-INFO
|
|
6
|
+
src/flecsi_skeleton.egg-info/SOURCES.txt
|
|
7
|
+
src/flecsi_skeleton.egg-info/dependency_links.txt
|
|
8
|
+
src/flecsi_skeleton.egg-info/entry_points.txt
|
|
9
|
+
src/flecsi_skeleton.egg-info/requires.txt
|
|
10
|
+
src/flecsi_skeleton.egg-info/top_level.txt
|
|
11
|
+
src/flecsi_skeleton/_auxiliary_files/README.md
|
|
12
|
+
src/flecsi_skeleton/_auxiliary_files/support/env.yaml
|
|
13
|
+
src/flecsi_skeleton/_internal/fileutils.py
|
|
14
|
+
src/flecsi_skeleton/_internal/main.py
|
|
15
|
+
src/flecsi_skeleton/_internal/options.py
|
|
16
|
+
src/flecsi_skeleton/_internal/templates.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
flecsi_skeleton
|