Skip to content

Commit

Permalink
Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
robertodr committed Nov 10, 2021
1 parent 5a7c8ec commit 96f991c
Show file tree
Hide file tree
Showing 8 changed files with 53 additions and 55 deletions.
37 changes: 18 additions & 19 deletions content/code/day-2/07_sycl-heat-equation/core.cpp
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
/* Copyright (c) 2021 CSC
*
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
Expand Down Expand Up @@ -39,8 +39,8 @@ void
evolve(queue Q, field *curr, field *prev, double a, double dt)
{
// Help the compiler avoid being confused by the structs
auto nx = curr->nx;
auto ny = curr->ny;
auto nx = curr->nx;
auto ny = curr->ny;

// Determine the temperature field at next time step
// As we have fixed boundary conditions, the outermost gridpoints
Expand All @@ -49,23 +49,22 @@ evolve(queue Q, field *curr, field *prev, double a, double dt)
auto dy2 = prev->dy * prev->dy;

{
buffer<double, 2> buf_curr{curr->data.data(), range<2>(nx+2, ny+2)}
, buf_prev{prev->data.data(), range<2>(nx+2, ny+2)};
buffer<double, 2> buf_curr { curr->data.data(), range<2>(nx + 2, ny + 2) },
buf_prev { prev->data.data(), range<2>(nx + 2, ny + 2) };

Q.submit([&](handler &cgh){
Q.submit([&](handler &cgh) {
auto curr = accessor(buf_curr, cgh, read_write);
auto prev = accessor(buf_prev, cgh, read_only);

cgh.parallel_for(range<2>(nx, ny),
[=](id<2> id) {
auto j = id[0] + 1;
auto i = id[1] + 1;
cgh.parallel_for(range<2>(nx, ny), [=](id<2> id) {
auto j = id[0] + 1;
auto i = id[1] + 1;

curr[j][i] =
prev[j][i] +
a * dt *
((prev[j][i+1] - 2.0 * prev[j][i] + prev[j][i-1]) / dx2 +
(prev[j+1][i] - 2.0 * prev[j][i] + prev[j-1][i]) / dy2);
curr[j][i] =
prev[j][i] +
a * dt *
((prev[j][i + 1] - 2.0 * prev[j][i] + prev[j][i - 1]) / dx2 +
(prev[j + 1][i] - 2.0 * prev[j][i] + prev[j - 1][i]) / dy2);
});
});
}
Expand Down
10 changes: 5 additions & 5 deletions content/code/day-2/07_sycl-heat-equation/heat.h
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
/* Copyright (c) 2021 CSC
*
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
Expand Down
10 changes: 5 additions & 5 deletions content/code/day-2/07_sycl-heat-equation/io.cpp
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
/* Copyright (c) 2021 CSC
*
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
Expand Down
11 changes: 5 additions & 6 deletions content/code/day-2/07_sycl-heat-equation/main.cpp
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
/* Copyright (c) 2021 CSC
*
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
Expand All @@ -22,7 +22,6 @@
// Main routine for heat equation solver in 2D.

#include <chrono>
#include <iostream>
#include <cstdio>

#include <sycl/sycl.hpp>
Expand Down
10 changes: 5 additions & 5 deletions content/code/day-2/07_sycl-heat-equation/pngwriter.c
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
/* Copyright (c) 2021 CSC
*
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
Expand Down
10 changes: 5 additions & 5 deletions content/code/day-2/07_sycl-heat-equation/pngwriter.h
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
/* Copyright (c) 2021 CSC
*
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
Expand Down
10 changes: 5 additions & 5 deletions content/code/day-2/07_sycl-heat-equation/setup.cpp
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
/* Copyright (c) 2021 CSC
*
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
Expand Down
10 changes: 5 additions & 5 deletions content/code/day-2/07_sycl-heat-equation/utilities.cpp
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
/* Copyright (c) 2021 CSC
*
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
Expand Down

0 comments on commit 96f991c

Please sign in to comment.