Data Parallel C++ implementation of c_sw kernel.#47
Conversation
Co-authored-by: Christoph Bauinger <c.bauinger@gmx.at>
| @@ -0,0 +1,79 @@ | |||
| This is a Data Parallel C++ implementation of the `c_sw` kernel extracted from the FV3 model. | |||
There was a problem hiding this comment.
I believe we should include a header:
The Data Parallel C++ C_SW Kernel.
as well as a Dependencies & Prerequisites sections to keep these three implementations standard. This could be a separate PR, but want to mention it.
robgpita
left a comment
There was a problem hiding this comment.
This is a huge addition. Thanks for the work in implementing the DPC++ version of c_sw!
I do not know C++ well, so I can not be too detailed in my review of the actual DPC++ syntax. I believe the compilation errors should be addressed as well as some other comments I've made before any of this code is merged. Not sure if others are having issues in compiling and testing this code, but I'm assuming the only dependency is the IntelOne API?
| add_definitions( -DNDEBUG ) | ||
| endif( ) | ||
|
|
||
| # Set flags depending on which compiler iis used |
There was a problem hiding this comment.
Typo, iis. Same in line 12 & 19.
| } | ||
| #endif | ||
|
|
||
| } No newline at end of file |
| Offset2DArray<double, true>& ua, Offset2DArray<double, true>& va, | ||
| Offset2DArray<double, true>& divg_d, | ||
| Offset2DArray<double, true>& uf, Offset2DArray<double, true>& vf) const; | ||
| }; No newline at end of file |
| { | ||
| Deallocate(in.size(), in.values, out, Q); | ||
| } | ||
| }; No newline at end of file |
| ) | ||
|
|
||
| SET(OBJS | ||
| /global/panfs01/admin/opt/intel/oneAPI/2021.1.2/compiler/2021.1.2/linux/compiler/lib/intel64_lin/for_main.o |
There was a problem hiding this comment.
Should this directory be hardcoded?
There was a problem hiding this comment.
During the configure process CMake detects it cannot find this file and errors. Why do we include this object file (that comes with the compiler) with the rest of the compiled code? If required, then we'll need to detect the location from the compiler installation. I also have this file inside the 2021.3.0 release but obviously at a different path.
If I comment it out then the CMake configure completes. Although, it may be needed when linking and I cannot get that far in the build process.
| @@ -0,0 +1,95 @@ | |||
| ! Copyright (C) 2020-2021 Intel Corporation | |||
|
|
|||
There was a problem hiding this comment.
It doesn't appear as though there is anything aside from a blank line in this PR, but I'm getting two errors ( Error: Invalid character in name at (1) & Error: Invalid character 0xC2 at (1) ) in lines 2, 6, 8, and 14 when trying to compile.
There was a problem hiding this comment.
My build crashes with errors on line 2, ,6, 8, 14. Line lines at those locations start with the "_" character.
git/SENA-c_sw/dpcpp/src/new_sw_core_interfaces.f90(2): error #5078: Unrecognized token '?' skipped
| real, intent(out), dimension(*) :: divg_d | ||
| end subroutine divergence_corner_from_f | ||
| end interface | ||
| end module No newline at end of file |
| jep1 = je + 1; | ||
|
|
||
| d2a2c_vect(sw_corner, se_corner, ne_corner, nw_corner, sin_sg, cosa_u, | ||
| cosa_v, cosa_s, rsin_u, rsin_v, rsin2, dxa, dya, u, v, ua, va, uc, vc, |
There was a problem hiding this comment.
I'm getting compilation errors stemming from this line.
/home/ubuntu/dpcpp/SENA-c_sw/dpcpp/src/new_sw_core.cpp:511:58: error: use of undeclared identifier 'sin_sg' d2a2c_vect(sw_corner, se_corner, ne_corner, nw_corner, sin_sg, cosa_u,
fatal error: too many errors emitted, stopping now [-ferror-limit=] 20 errors generated
| memallocator.Deallocate<double, true>(dxa, nullptr, Q); | ||
| memallocator.Deallocate<double, true>(dya, nullptr, Q); | ||
|
|
||
| } No newline at end of file |
| d.utmp(i, j,k) = d.a2 * (d.u(i, j-1,k) + d.u(i, j+2,k)) + d.a1 * (d.u(i, j,k) + d.u(i, j+1,k)); | ||
| // } | ||
| //} | ||
| }); |
There was a problem hiding this comment.
Out of curiosity, is the .wait() omitted here because this loop runs very quickly?
There was a problem hiding this comment.
Good question... Initially I thought it was because nothing depended on this value in the following code. Except, the vtmp variable below has a wait. They both cannot be correct. Both utmp and vtmp are used at line 480 so my guess this should have a wait.
| # | ||
| # The following paths will be searched in order if set in CMake (first priority) or environment (second priority) | ||
| # | ||
| # - NetCDF_ROOT - root of NetCDF installation |
There was a problem hiding this comment.
This is probably going to be an issue in the future. NetCDF has split C, C++, Fortran into separate projects that must be compiled and installed separately. The version numbers have diverging rapidly so a single NetCDF_ROOT variable is going to need to be more specific for future releases. Something along the lines of NetCDF_C_ROOT, NetCDF_CXX_ROOT and NetCDF_F_ROOT is going to be needed.
| #include <chrono> | ||
|
|
||
| #include "new_sw_core.hpp" | ||
| #include <CL/sycl.hpp> |
There was a problem hiding this comment.
I get compiler errors nested pretty deep within the OneAPI provided CL/sycl.hpp include.
In file included from apps/oneapi/2021.3.0/compiler/2021.3.0/linux/include/sycl/CL/sycl/ONEAPI/atomic_enums.hpp(12),
from apps/oneapi/2021.3.0/compiler/2021.3.0/linux/include/sycl/CL/sycl/ONEAPI/atomic_accessor.hpp(11),
from /apps/oneapi/2021.3.0/compiler/2021.3.0/linux/include/sycl/CL/sycl/ONEAPI/atomic.hpp(11),
from apps/oneapi/2021.3.0/compiler/2021.3.0/linux/include/sycl/CL/sycl.hpp(11),
from git/SENA-c_sw/dpcpp/src/new_sw_core.hpp(24),
from git/SENA-c_sw/dpcpp/src/new_sw_core.cpp(25):
apps/oneapi/2021.3.0/compiler/2021.3.0/linux/include/sycl/CL/sycl/detail/common.hpp(318): error: no default constructor exists for class "cl::sycl::mode_tag_t<(cl::sycl::access_mode={cl::sycl::access::mode})1024>"
static constexpr T value{};
BryanFlynt
left a comment
There was a problem hiding this comment.
This still needs some work before it's portable outside of Intel's development environment. We have a hard coded path in the cmake file and some phantom "_" characters in the F code. When I work around these I still get compiler errors inside the OneAPI library itself. My guess is those are a result of compiler versions or system configuration so we need to work out a way to make this work for the average user.
Co-authored-by: Christoph Bauinger c.bauinger@gmx.at
Proposed changes
This is a Data Parallel C++ implementation of the c_sw kernel. The intent is for evaluation of new language options for potential migration.