Skip to content

Commit

Permalink
Merge pull request #261 from intel/develop
Browse files Browse the repository at this point in the history
Develop bug fixes
  • Loading branch information
chuckyount authored Nov 22, 2022
2 parents 50b48e1 + ea7b13b commit 9662357
Show file tree
Hide file tree
Showing 20 changed files with 207 additions and 95 deletions.
17 changes: 9 additions & 8 deletions docs/api/html/classyask_1_1yk__env-members.html
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,15 @@
<p>This is the complete list of members for <a class="el" href="classyask_1_1yk__env.html">yask::yk_env</a>, including all inherited members.</p>
<table class="directory">
<tr class="even"><td class="entry"><a class="el" href="classyask_1_1yk__env.html#ab14fa168dc78346ac61b54c9a509099b">disable_debug_output</a>()</td><td class="entry"><a class="el" href="classyask_1_1yk__env.html">yask::yk_env</a></td><td class="entry"><span class="mlabel">static</span></td></tr>
<tr><td class="entry"><a class="el" href="classyask_1_1yk__env.html#a69eac2bb8a841f6259697a7dcc8cf386">get_debug_output</a>()</td><td class="entry"><a class="el" href="classyask_1_1yk__env.html">yask::yk_env</a></td><td class="entry"><span class="mlabel">static</span></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classyask_1_1yk__env.html#add8b12cd6d10f964665a41acedbb9b14">get_num_ranks</a>() const =0</td><td class="entry"><a class="el" href="classyask_1_1yk__env.html">yask::yk_env</a></td><td class="entry"><span class="mlabel">pure virtual</span></td></tr>
<tr><td class="entry"><a class="el" href="classyask_1_1yk__env.html#a93deb7b62612742f5a85fd8e319df38c">get_rank_index</a>() const =0</td><td class="entry"><a class="el" href="classyask_1_1yk__env.html">yask::yk_env</a></td><td class="entry"><span class="mlabel">pure virtual</span></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classyask_1_1yk__env.html#a2384185b4d346418a62db1310a3dddca">global_barrier</a>() const =0</td><td class="entry"><a class="el" href="classyask_1_1yk__env.html">yask::yk_env</a></td><td class="entry"><span class="mlabel">pure virtual</span></td></tr>
<tr><td class="entry"><a class="el" href="classyask_1_1yk__env.html#abe162669b192b8c650ee7dbfbd62bb7d">is_trace_enabled</a>()</td><td class="entry"><a class="el" href="classyask_1_1yk__env.html">yask::yk_env</a></td><td class="entry"><span class="mlabel">static</span></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classyask_1_1yk__env.html#aa5cf0e8d885f4d9ebde6539d5246cda1">set_debug_output</a>(yask_output_ptr debug)</td><td class="entry"><a class="el" href="classyask_1_1yk__env.html">yask::yk_env</a></td><td class="entry"><span class="mlabel">static</span></td></tr>
<tr><td class="entry"><a class="el" href="classyask_1_1yk__env.html#ac6b39c25ae59e27dcdb405a9fe24e763">set_trace_enabled</a>(bool enable)</td><td class="entry"><a class="el" href="classyask_1_1yk__env.html">yask::yk_env</a></td><td class="entry"><span class="mlabel">static</span></td></tr>
<tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>~yk_env</b>() (defined in <a class="el" href="classyask_1_1yk__env.html">yask::yk_env</a>)</td><td class="entry"><a class="el" href="classyask_1_1yk__env.html">yask::yk_env</a></td><td class="entry"><span class="mlabel">inline</span><span class="mlabel">virtual</span></td></tr>
<tr><td class="entry"><a class="el" href="classyask_1_1yk__env.html#ab2d17018fe9fadd9bfdc091d8bf32feb">finalize</a>()=0</td><td class="entry"><a class="el" href="classyask_1_1yk__env.html">yask::yk_env</a></td><td class="entry"><span class="mlabel">pure virtual</span></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classyask_1_1yk__env.html#a69eac2bb8a841f6259697a7dcc8cf386">get_debug_output</a>()</td><td class="entry"><a class="el" href="classyask_1_1yk__env.html">yask::yk_env</a></td><td class="entry"><span class="mlabel">static</span></td></tr>
<tr><td class="entry"><a class="el" href="classyask_1_1yk__env.html#add8b12cd6d10f964665a41acedbb9b14">get_num_ranks</a>() const =0</td><td class="entry"><a class="el" href="classyask_1_1yk__env.html">yask::yk_env</a></td><td class="entry"><span class="mlabel">pure virtual</span></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classyask_1_1yk__env.html#a93deb7b62612742f5a85fd8e319df38c">get_rank_index</a>() const =0</td><td class="entry"><a class="el" href="classyask_1_1yk__env.html">yask::yk_env</a></td><td class="entry"><span class="mlabel">pure virtual</span></td></tr>
<tr><td class="entry"><a class="el" href="classyask_1_1yk__env.html#a2384185b4d346418a62db1310a3dddca">global_barrier</a>() const =0</td><td class="entry"><a class="el" href="classyask_1_1yk__env.html">yask::yk_env</a></td><td class="entry"><span class="mlabel">pure virtual</span></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classyask_1_1yk__env.html#abe162669b192b8c650ee7dbfbd62bb7d">is_trace_enabled</a>()</td><td class="entry"><a class="el" href="classyask_1_1yk__env.html">yask::yk_env</a></td><td class="entry"><span class="mlabel">static</span></td></tr>
<tr><td class="entry"><a class="el" href="classyask_1_1yk__env.html#aa5cf0e8d885f4d9ebde6539d5246cda1">set_debug_output</a>(yask_output_ptr debug)</td><td class="entry"><a class="el" href="classyask_1_1yk__env.html">yask::yk_env</a></td><td class="entry"><span class="mlabel">static</span></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classyask_1_1yk__env.html#ac6b39c25ae59e27dcdb405a9fe24e763">set_trace_enabled</a>(bool enable)</td><td class="entry"><a class="el" href="classyask_1_1yk__env.html">yask::yk_env</a></td><td class="entry"><span class="mlabel">static</span></td></tr>
<tr bgcolor="#f0f0f0"><td class="entry"><b>~yk_env</b>() (defined in <a class="el" href="classyask_1_1yk__env.html">yask::yk_env</a>)</td><td class="entry"><a class="el" href="classyask_1_1yk__env.html">yask::yk_env</a></td><td class="entry"><span class="mlabel">inline</span><span class="mlabel">virtual</span></td></tr>
</table></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Expand Down
31 changes: 31 additions & 0 deletions docs/api/html/classyask_1_1yk__env.html
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@
<tr class="memitem:a2384185b4d346418a62db1310a3dddca"><td class="memItemLeft" align="right" valign="top">virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classyask_1_1yk__env.html#a2384185b4d346418a62db1310a3dddca">global_barrier</a> () const =0</td></tr>
<tr class="memdesc:a2384185b4d346418a62db1310a3dddca"><td class="mdescLeft">&#160;</td><td class="mdescRight">Wait until all ranks have reached this element. <a href="#a2384185b4d346418a62db1310a3dddca">More...</a><br /></td></tr>
<tr class="separator:a2384185b4d346418a62db1310a3dddca"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ab2d17018fe9fadd9bfdc091d8bf32feb"><td class="memItemLeft" align="right" valign="top">virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classyask_1_1yk__env.html#ab2d17018fe9fadd9bfdc091d8bf32feb">finalize</a> ()=0</td></tr>
<tr class="memdesc:ab2d17018fe9fadd9bfdc091d8bf32feb"><td class="mdescLeft">&#160;</td><td class="mdescRight">Finalize the environment. <a href="#ab2d17018fe9fadd9bfdc091d8bf32feb">More...</a><br /></td></tr>
<tr class="separator:ab2d17018fe9fadd9bfdc091d8bf32feb"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-static-methods"></a>
Static Public Member Functions</h2></td></tr>
Expand Down Expand Up @@ -357,6 +360,34 @@ <h2 class="memtitle"><span class="permalink"><a href="#a2384185b4d346418a62db131
<p>Wait until all ranks have reached this element. </p>
<p>If MPI is enabled, calls <code>MPI_Barrier()</code>. Otherwise, has no effect. </p>

</div>
</div>
<a id="ab2d17018fe9fadd9bfdc091d8bf32feb"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ab2d17018fe9fadd9bfdc091d8bf32feb">&#9670;&nbsp;</a></span>finalize()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">virtual void yask::yk_env::finalize </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">pure virtual</span></span> </td>
</tr>
</table>
</div><div class="memdoc">

<p>Finalize the environment. </p>
<p>If MPI is enabled and YASK initialized the MPI communicator, calls <code>MPI_Finalize()</code>. This function is automatically called when a <a class="el" href="classyask_1_1yk__env.html" title="Kernel environment.">yk_env</a> object is destroyed. Cannot call <a class="el" href="classyask_1_1yk__env.html#a2384185b4d346418a62db1310a3dddca" title="Wait until all ranks have reached this element.">global_barrier()</a> or any MPI-dependent API after calling this. </p>

</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>
Expand Down
5 changes: 4 additions & 1 deletion docs/api/html/functions_f.html
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,17 @@
<div class="textblock">Here is a list of all documented class members with links to the class documentation for each member:</div>

<h3><a id="index_f"></a>- f -</h3><ul>
<li>finalize()
: <a class="el" href="classyask_1_1yk__env.html#ab2d17018fe9fadd9bfdc091d8bf32feb">yask::yk_env</a>
</li>
<li>first_domain_index()
: <a class="el" href="classyask_1_1yc__solution__base.html#a56f644e7e6b4e96619245f217b3763b5">yask::yc_solution_base</a>
</li>
<li>format()
: <a class="el" href="classyask_1_1yc__solution.html#a5f3624ded964c465724fd0221d5a2aaa">yask::yc_solution</a>
</li>
<li>format_indices()
: <a class="el" href="classyask_1_1yk__var.html#ae929dea5359d07e7541abab78ca7b139">yask::yk_var</a>
: <a class="el" href="classyask_1_1yk__var.html#a55d6c585b8384881065c01bb067c96dd">yask::yk_var</a>
</li>
<li>format_simple()
: <a class="el" href="classyask_1_1yc__expr__node.html#a1af7948d0c2a977ed20c0b2d1d561052">yask::yc_expr_node</a>
Expand Down
5 changes: 4 additions & 1 deletion docs/api/html/functions_func_f.html
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,17 @@
&#160;

<h3><a id="index_f"></a>- f -</h3><ul>
<li>finalize()
: <a class="el" href="classyask_1_1yk__env.html#ab2d17018fe9fadd9bfdc091d8bf32feb">yask::yk_env</a>
</li>
<li>first_domain_index()
: <a class="el" href="classyask_1_1yc__solution__base.html#a56f644e7e6b4e96619245f217b3763b5">yask::yc_solution_base</a>
</li>
<li>format()
: <a class="el" href="classyask_1_1yc__solution.html#a5f3624ded964c465724fd0221d5a2aaa">yask::yc_solution</a>
</li>
<li>format_indices()
: <a class="el" href="classyask_1_1yk__var.html#ae929dea5359d07e7541abab78ca7b139">yask::yk_var</a>
: <a class="el" href="classyask_1_1yk__var.html#a55d6c585b8384881065c01bb067c96dd">yask::yk_var</a>
</li>
<li>format_simple()
: <a class="el" href="classyask_1_1yc__expr__node.html#a1af7948d0c2a977ed20c0b2d1d561052">yask::yc_expr_node</a>
Expand Down
1 change: 1 addition & 0 deletions docs/api/html/search/all_6.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions docs/api/html/search/functions_6.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions docs/api/html/yask__kernel__api_8hpp_source.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/api/html/yk__var__api_8hpp_source.html
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@
<div class="ttc" id="ayask__kernel__api_8hpp_html"><div class="ttname"><a href="yask__kernel__api_8hpp.html">yask_kernel_api.hpp</a></div></div>
<div class="ttc" id="aclassyask_1_1yk__var_html_a420e0dde2114ba663069b16d579072eb"><div class="ttname"><a href="classyask_1_1yk__var.html#a420e0dde2114ba663069b16d579072eb">yask::yk_var::is_fixed_size</a></div><div class="ttdeci">virtual bool is_fixed_size() const =0</div><div class="ttdoc">Determine whether this var is not automatically resized based on the solution.</div></div>
<div class="ttc" id="aclassyask_1_1yk__var_html_a4a4e42c4cfc5b3b6a5d998611d0d8602"><div class="ttname"><a href="classyask_1_1yk__var.html#a4a4e42c4cfc5b3b6a5d998611d0d8602">yask::yk_var::get_raw_storage_buffer</a></div><div class="ttdeci">virtual void * get_raw_storage_buffer()=0</div><div class="ttdoc">[Advanced] Get pointer to raw data storage buffer.</div></div>
<div class="ttc" id="agroup__yk_html_gab1c5abbc86c9fdde32def4217482cc63"><div class="ttname"><a href="group__yk.html#gab1c5abbc86c9fdde32def4217482cc63">yask::yk_grid</a></div><div class="ttdeci">YASK_DEPRECATED typedef yk_var yk_grid</div><div class="ttdoc">[Deprecated] Use yk_var.</div><div class="ttdef"><b>Definition:</b> yask_kernel_api.hpp:245</div></div>
<div class="ttc" id="agroup__yk_html_gab1c5abbc86c9fdde32def4217482cc63"><div class="ttname"><a href="group__yk.html#gab1c5abbc86c9fdde32def4217482cc63">yask::yk_grid</a></div><div class="ttdeci">YASK_DEPRECATED typedef yk_var yk_grid</div><div class="ttdoc">[Deprecated] Use yk_var.</div><div class="ttdef"><b>Definition:</b> yask_kernel_api.hpp:257</div></div>
<div class="ttc" id="aclassyask_1_1yk__var_html_ae62308be69ca643714879b0a1362de0e"><div class="ttname"><a href="classyask_1_1yk__var.html#ae62308be69ca643714879b0a1362de0e">yask::yk_var::get_left_extra_pad_size</a></div><div class="ttdeci">virtual idx_t get_left_extra_pad_size(const std::string &amp;dim) const =0</div><div class="ttdoc">Get the actual extra left padding in the specified dimension.</div></div>
<div class="ttc" id="aclassyask_1_1yk__var_html_a3611ad6d130cb5ee7e030e6ad0c24f5b"><div class="ttname"><a href="classyask_1_1yk__var.html#a3611ad6d130cb5ee7e030e6ad0c24f5b">yask::yk_var::is_storage_layout_identical</a></div><div class="ttdeci">virtual bool is_storage_layout_identical(const yk_var_ptr other) const =0</div><div class="ttdoc">[Advanced] Determines whether storage layout is the same as another var.</div></div>
<div class="ttc" id="aclassyask_1_1yk__var_html_aaf5b3f06b832bbf77b8f722fda8a2998"><div class="ttname"><a href="classyask_1_1yk__var.html#aaf5b3f06b832bbf77b8f722fda8a2998">yask::yk_var::get_first_local_index</a></div><div class="ttdeci">virtual idx_t get_first_local_index(const std::string &amp;dim) const =0</div><div class="ttdoc">Get the first valid index in this rank in the specified dimension.</div></div>
Expand Down
12 changes: 12 additions & 0 deletions include/yask_kernel_api.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,18 @@ namespace yask {
virtual void
global_barrier() const =0;

/// Finalize the environment.
/**
If MPI is enabled and YASK initialized the MPI communicator,
calls `MPI_Finalize()`.
This function is automatically called when a yk_env object
is destroyed.
Cannot call global_barrier() or any MPI-dependent API after
calling this.
*/
virtual void
finalize() =0;

}; // yk_env.

/// **[Deprecated]** Use yk_var.
Expand Down
2 changes: 1 addition & 1 deletion src/common/common_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ namespace yask {
// for numbers above 9 (at least up to 99).

// Format: "major.minor.patch[-alpha|-beta]".
const string version = "4.00.02";
const string version = "4.00.03";

string yask_get_version_string() {
return version;
Expand Down
12 changes: 8 additions & 4 deletions src/kernel/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -965,15 +965,19 @@ $(YK_API_TEST_EXEC): $(YK_TEST_SRC_DIR)/yask_kernel_api_test.cpp $(YK_LIB)
@ls -l $@

# Build and run C++ tests.
# First run on 1 rank, then multiple ranks if ranks>1.
cxx-yk-api-test:
$(TEST_MAKE) $(YK_API_TEST_EXEC) allow_new_var_types=1
@echo '*** Running the C++ YASK kernel API test...'
$(RUN_PREFIX) $(YK_API_TEST_EXEC)
if (( $(ranks) > 1 )); then $(RUN_PREFIX) mpirun -np $(ranks) $(YK_API_TEST_EXEC); fi

# Run Python kernel API test.
# First run on 1 rank, then multiple ranks if ranks>1.
py-yk-api-test: $(YK_TEST_SRC_DIR)/yask_kernel_api_test.py $(YK_PY_LIB)
@echo '*** Running the Python YASK kernel API test...'
$(RUN_PYTHON) $<
if (( $(ranks) > 1 )); then mpirun -np $(ranks) $(RUN_PYTHON) $<; fi

# Build C++ kernel tests with exceptions.
$(YK_API_TEST_EXEC_WITH_EXCEPTION): $(YK_TEST_SRC_DIR)/yask_kernel_api_exception_test.cpp $(YK_LIB)
Expand Down Expand Up @@ -1063,10 +1067,10 @@ yk-test-no-yc: kernel-no-yc $(YK_SCRIPT)

# Run the kernel API tests for C++ and Python with and w/o expected exceptions.
api-tests:
$(MAKE) clean; $(MAKE) cxx-yk-api-test real_bytes=8 stencil=iso3dfd
$(MAKE) clean; $(MAKE) py-yk-api-test stencil=iso3dfd
$(MAKE) clean; $(MAKE) cxx-yk-api-test-with-exception real_bytes=8 stencil=iso3dfd
$(MAKE) clean; $(MAKE) py-yk-api-test-with-exception stencil=iso3dfd
$(MAKE) clean; $(MAKE) cxx-yk-api-test real_bytes=8
$(MAKE) clean; $(MAKE) py-yk-api-test
$(MAKE) clean; $(MAKE) cxx-yk-api-test-with-exception real_bytes=8
$(MAKE) clean; $(MAKE) py-yk-api-test-with-exception

# Run several stencils using built-in validation.
# NB: set arch var as applicable.
Expand Down
15 changes: 14 additions & 1 deletion src/kernel/lib/settings.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ namespace yask {
MPI_Group group = MPI_GROUP_NULL;
int num_ranks = 1; // total number of ranks.
int my_rank = 0; // MPI-assigned index.
bool finalize_needed = false;

// Vars for shared-mem ranks.
MPI_Comm shm_comm = MPI_COMM_NULL; // shm communicator.
Expand All @@ -81,12 +82,24 @@ namespace yask {
int max_threads=0; // initial value from OMP.

KernelEnv() { }
virtual ~KernelEnv() { }
virtual ~KernelEnv() {
finalize();
}

// Init MPI, OMP, etc.
// This is normally called very early in the program.
virtual void init_env(int* argc, char*** argv, MPI_Comm comm);

virtual void finalize() {
TRACE_MSG("finalize_needed = " << finalize_needed);
if (comm != MPI_COMM_NULL && finalize_needed) {
MPI_Finalize();
comm = MPI_COMM_NULL;
shm_comm = MPI_COMM_NULL;
}
finalize_needed = false;
}

// Lock.
static void set_debug_lock() {
if (!_debug_lock_init_done) {
Expand Down
1 change: 1 addition & 0 deletions src/kernel/lib/setup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ namespace yask {
THROW_YASK_EXCEPTION("error: MPI_THREAD_SERIALIZED or MPI_THREAD_MULTIPLE not provided");
}
is_init = true;
finalize_needed = true;
}
comm = MPI_COMM_WORLD;
}
Expand Down
Loading

0 comments on commit 9662357

Please sign in to comment.