Skip to content

Commit

Permalink
Merge pull request #290 from intel/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
chuckyount authored Apr 25, 2024
2 parents abb66ec + 4105e91 commit cb75540
Show file tree
Hide file tree
Showing 9 changed files with 32 additions and 18 deletions.
2 changes: 1 addition & 1 deletion src/common/common_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ namespace yask {
// https://semver.org/.

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

string yask_get_version_string() {
return version;
Expand Down
20 changes: 14 additions & 6 deletions src/examples/swe_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -320,12 +320,12 @@ int main(int argc, char** argv) {
double t_export = 0.02;

// Some 1D buffers used to copy slices of data to/from YASK vars.
double hbuf[ysz];
double ebuf[ysz];
double ubuf[ysz];
double vbuf[ysz];
double keHbuf[ysz];
double pebuf[ysz];
auto* hbuf = new double[ysz];
auto* ebuf = new double[ysz];
auto* ubuf = new double[ysz];
auto* vbuf = new double[ysz];
auto* keHbuf = new double[ysz];
auto* pebuf = new double[ysz];

// Init whole vars to default values.
h->set_all_elements_same(1.0);
Expand Down Expand Up @@ -601,6 +601,14 @@ int main(int argc, char** argv) {
}
#endif

// Free buffers.
delete[] hbuf;
delete[] ebuf;
delete[] ubuf;
delete[] vbuf;
delete[] keHbuf;
delete[] pebuf;

// Report global error.
if (rank_num == msg_rank) {
gerr_L2 = sqrt(gerr_L2);
Expand Down
5 changes: 4 additions & 1 deletion src/examples/wave_eq_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ int main(int argc, char** argv) {
soln->get_var("depth")->set_element(h, {});

// Buffer used to copy slices of data to/from YASK var.
double ebuf[ysz];
auto* ebuf = new double[ysz];

// Init vars.
e->set_all_elements_same(0.0);
Expand Down Expand Up @@ -392,6 +392,9 @@ int main(int argc, char** argv) {
}
#endif

// Free buffer.
delete[] ebuf;

// Report global stats.
if (rank_num == msg_rank) {
oerr_L2 = sqrt(oerr_L2);
Expand Down
3 changes: 1 addition & 2 deletions src/kernel/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -881,7 +881,6 @@ help:
@echo "Example debug builds of kernel cmd-line tool:"; \
echo " $(MAKE) clean; $(MAKE) -j stencil=iso3dfd mpi=0 omp=0 YK_CXXOPT='-O0' check=1 # No optimization, OpenMP, or MPI; use internal checking"; \
echo " $(MAKE) clean; $(MAKE) -j arch=avx2 stencil=test_2d YK_CXXOPT='-O0' trace=1 # Enable tracing; run with '-trace' to get trace"; \
#echo " $(MAKE) clean; $(MAKE) -j arch=intel64 stencil=ssg radius=0 fold='x=1,y=1,z=1' YK_CXXOPT='-O0' trace_mem=1 # Trace all mem accesses with '-trace'"; \
echo " "
@echo "Example regression tests (run before any git push or pull request):"; \
echo " $(MAKE) -j all # Normal full API and stencil tests"; \
Expand Down Expand Up @@ -1090,7 +1089,7 @@ single-stencil-tests:
$(MAKE) clean; $(STENCIL_TEST) stencil=test_empty_2d
$(MAKE) clean; $(STENCIL_TEST) stencil=test_2d YK_STENCIL_SUFFIX=-t1 $(call FOLD,x=2 y=2) inner_loop_dim=1
$(MAKE) clean; $(STENCIL_TEST) stencil=test_2d YK_STENCIL_SUFFIX=-t2 $(call FOLD,x=2 y=2) inner_loop_dim=2
$(MAKE) clean; $(STENCIL_TEST) stencil=test_2d YK_STENCIL_SUFFIX=-t3 arch=intel64 $(call FOLD,x=3 y=2) domain_dims=y,x
$(MAKE) clean; $(STENCIL_TEST) stencil=test_2d YK_STENCIL_SUFFIX=-t3 arch=intel64 domain_dims=y,x
$(MAKE) clean; $(STENCIL_TEST) stencil=test_reverse_2d YK_STENCIL_SUFFIX=-t1 radius=1
$(MAKE) clean; $(STENCIL_TEST) stencil=test_stages_2d $(call FOLD,x=2 y=2)
$(MAKE) clean; $(STENCIL_TEST) stencil=test_misc_2d YK_STENCIL_SUFFIX=-t1 $(call FOLD,x=2 y=2) inner_misc_layout=0 outer_domain_layout=0
Expand Down
9 changes: 5 additions & 4 deletions src/kernel/lib/generic_var.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,6 @@ namespace yask {
const T v = val;
T* RESTRICT e = elems;

#pragma omp simd
for (idx_t i = start; i < stop; i++)
e[i] = v;
});
Expand Down Expand Up @@ -179,9 +178,11 @@ namespace yask {
T* RESTRICT e = elems;
const T s = seed;

#pragma omp simd
for (idx_t i = start; i < stop; i++)
e[i] = s * T(imod_flr(i, wrap) + 1);
for (idx_t i = start; i < stop; i++) {
T v = s * T(imod_flr(i, wrap) + 1);
e[i] = v;
//cout << "e["<<i<<"] = "<< v <<endl;
}
});

// Also update the version on the device to the same sequence.
Expand Down
2 changes: 2 additions & 0 deletions src/kernel/lib/yask.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ typedef int MPI_Status;
#include <unordered_set>
#include <sstream>
#include <stdexcept>
#include <limits>

#include <malloc.h>
#include <stddef.h>
#include <time.h>
Expand Down
2 changes: 1 addition & 1 deletion src/kernel/lib/yk_var.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ namespace yask {
}
}
assert(dim_names.size() ==
_num_step_dims + _num_domain_dims + _num_misc_dims);
size_t(_num_step_dims + _num_domain_dims + _num_misc_dims));
}


Expand Down
6 changes: 3 additions & 3 deletions src/kernel/lib/yk_var.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -575,8 +575,8 @@ namespace yask {
double _sum = 0.0;
double _sum_sq = 0.0;
double _prod = 1.0;
double _max = DBL_MIN;
double _min = DBL_MAX;
double _max = std::numeric_limits<double>::min();
double _min = std::numeric_limits<double>::max();

virtual ~red_res() { }

Expand Down Expand Up @@ -1120,7 +1120,7 @@ namespace yask {
make_index_string(range));
if (ne <= 0)
return 0;
if (buffer_size < ne)
if (buffer_size < size_t(ne))
THROW_YASK_EXCEPTION(std::string("call to '") +
Visitor::fname() + "' with buffer of size " +
std::to_string(buffer_size) + "; " +
Expand Down
1 change: 1 addition & 0 deletions src/kernel/yask.sh
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,7 @@ if [[ $nranks > 1 || $force_mpi == 1 ]]; then

# Add default Intel MPI settings.
envs+=" I_MPI_PRINT_VERSION=1 I_MPI_DEBUG=5"
envs+=" I_MPI_PIN_DOMAIN=numa"

# Check whether HBM policy setting is allowed.
if [[ `I_MPI_HBW_POLICY=hbw_preferred,hbw_preferred mpirun -np 1 /bin/date |& grep -c 'Unknown memory policy'` == 0 ]]; then
Expand Down

0 comments on commit cb75540

Please sign in to comment.