From 41bd6df65eb1fe7201305269b687d39c3a6c4421 Mon Sep 17 00:00:00 2001 From: Saveliy Date: Sat, 14 Jun 2025 21:59:03 +0300 Subject: [PATCH 01/14] add different axes for currents --- coarray/fdtd.F90 | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/coarray/fdtd.F90 b/coarray/fdtd.F90 index 80cc222..ac37e7f 100644 --- a/coarray/fdtd.F90 +++ b/coarray/fdtd.F90 @@ -3,8 +3,8 @@ program fdtd_coarray_optimized implicit none ! Parameters - integer, parameter :: Ni = 512, Nj = 512, Nk = 512 - integer, parameter :: num_iterations = 25 + integer, parameter :: Ni = 32, Nj = 32, Nk = 32 + integer, parameter :: num_iterations = 100 real(8), parameter :: C = 3e10, PI = 3.14159265358 real(8), parameter :: dx = C, dy = C, dz = C, dt = 0.2 real(8), parameter :: coef_B_dx = C * dt / (2 * dx), coef_B_dy = C * dt / (2 * dy), coef_B_dz = C * dt / (2 * dz) @@ -14,7 +14,7 @@ program fdtd_coarray_optimized ! Field arrays (optimized layout for vectorization) real(8), allocatable :: Ex(:,:,:)[:], Ey(:,:,:)[:], Ez(:,:,:)[:] real(8), allocatable :: Bx(:,:,:)[:], By(:,:,:)[:], Bz(:,:,:)[:] - real(8), allocatable :: Jx(:,:,:)[:] + real(8), allocatable :: Jx(:,:,:)[:], Jy(:,:,:)[:], Jz(:,:,:)[:] real(8), allocatable :: next_Ex(:,:)[:], next_Ey(:,:)[:], pred_Bx(:,:)[:], pred_By(:,:)[:] ! Local variables @@ -58,7 +58,9 @@ program fdtd_coarray_optimized allocate(By(Ni, Nj, k_local)[*]) allocate(Bz(Ni, Nj, k_local)[*]) allocate(Jx(Ni, Nj, k_local)[*]) - + allocate(Jy(Ni, Nj, k_local)[*]) + allocate(Jz(Ni, Nj, k_local)[*]) + allocate(next_Ex(Ni, Nj)[*]) allocate(next_Ey(Ni, Nj)[*]) allocate(pred_Bx(Ni, Nj)[*]) @@ -115,7 +117,7 @@ program fdtd_coarray_optimized call print_full_E_slice() end if - deallocate(Ex, Ey, Ez, Bx, By, Bz, Jx) + deallocate(Ex, Ey, Ez, Bx, By, Bz, Jx, Jy, Jz) deallocate(next_Ex, next_Ey, pred_Bx, pred_By) contains @@ -150,6 +152,8 @@ subroutine init_fields By = 0.0 Bz = 0.0 Jx = 0.0 + Jy = 0.0 + Jz = 0.0 end subroutine init_fields !=============================================================== @@ -157,16 +161,19 @@ subroutine init_currents(this_t) integer, intent(in) :: this_t integer :: i, j, k integer :: this_cur_img + real(8) :: value do k = start_k, max_k do j = start_j, max_j do i = start_i, max_i this_cur_img = ceiling(real(k) / real(k_local)) - Jx(i,j,k - (this_cur_img - 1) * k_local)[this_cur_img] = & - (sin(2.0 * PI * this_t * dt / TT)) & - * (cos(2.0 * PI * (i-1) * dx / Tx)**2) & - * (cos(2.0 * PI * (j-1) * dy / Ty)**2) & - * (cos(2.0 * PI * (k-1) * dz / Tz)**2) + value = (sin(2.0 * PI * this_t * dt / TT)) & + * (cos(2.0 * PI * (i-1) * dx / Tx)**2) & + * (cos(2.0 * PI * (j-1) * dy / Ty)**2) & + * (cos(2.0 * PI * (k-1) * dz / Tz)**2) + Jx(i,j,k - (this_cur_img - 1) * k_local)[this_cur_img] = value + Jy(i,j,k - (this_cur_img - 1) * k_local)[this_cur_img] = value + Jz(i,j,k - (this_cur_img - 1) * k_local)[this_cur_img] = value end do end do end do @@ -226,11 +233,11 @@ subroutine update_E_field coef_E_dy * (Bz(i,j,1) - Bz(i,jm,1)) - & coef_E_dz * (By(i,j,1) - pred_By(i,j)) - Ey(i,j,1) = Ey(i,j,1) - coef_J * Jx(i,j,1) + & + Ey(i,j,1) = Ey(i,j,1) - coef_J * Jy(i,j,1) + & coef_E_dz * (Bx(i,j,1) - pred_Bx(i,j)) - & coef_E_dx * (Bz(i,j,1) - Bz(im,j,1)) - Ez(i,j,1) = Ez(i,j,1) - coef_J * Jx(i,j,1) + & + Ez(i,j,1) = Ez(i,j,1) - coef_J * Jz(i,j,1) + & coef_E_dx * (By(i,j,1) - By(im,j,1)) - & coef_E_dy * (Bx(i,j,1) - Bx(i,jm,1)) end do @@ -245,11 +252,11 @@ subroutine update_E_field coef_E_dy * (Bz(i,j,k) - Bz(i,jm,k)) - & coef_E_dz * (By(i,j,k) - By(i,j,k-1)) - Ey(i,j,k) = Ey(i,j,k) - coef_J * Jx(i,j,k) + & + Ey(i,j,k) = Ey(i,j,k) - coef_J * Jy(i,j,k) + & coef_E_dz * (Bx(i,j,k) - Bx(i,j,k-1)) - & coef_E_dx * (Bz(i,j,k) - Bz(im,j,k)) - Ez(i,j,k) = Ez(i,j,k) - coef_J * Jx(i,j,k) + & + Ez(i,j,k) = Ez(i,j,k) - coef_J * Jz(i,j,k) + & coef_E_dx * (By(i,j,k) - By(im,j,k)) - & coef_E_dy * (Bx(i,j,k) - Bx(i,jm,k)) end do From 23ed0b7a6994470c5b8f3e6a775ec4d3694fff6d Mon Sep 17 00:00:00 2001 From: Saveliy Borisov Date: Sat, 14 Jun 2025 22:14:43 +0300 Subject: [PATCH 02/14] Update main.yml --- .github/workflows/main.yml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 3222255..f86b6a8 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -49,3 +49,26 @@ jobs: shell: bash run: | ${PWD}/bin/sample + + - name: Install Intel OneAPI (ifort) + run: | + wget -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB | gpg --dearmor | sudo tee /usr/share/keyrings/oneapi-archive-keyring.gpg > /dev/null + echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list + sudo apt-get update + sudo apt-get install -y intel-oneapi-compiler-fortran + + - name: Set up Intel environment + run: | + source /opt/intel/oneapi/setvars.sh + echo "source /opt/intel/oneapi/setvars.sh" >> $GITHUB_ENV + + - name: Compile Coarray program with ifort + run: | + source /opt/intel/oneapi/setvars.sh + ifort -coarray /coarray/fdtd.F90 -o fdtd + + - name: Run Coarray program + run: | + source /opt/intel/oneapi/setvars.sh + export FOR_COARRAY_NUM_IMAGES=4 + ./fdtd From cb6c10bdc861074d7aa99d6450184560ca1d7a34 Mon Sep 17 00:00:00 2001 From: Saveliy Borisov Date: Sat, 14 Jun 2025 22:18:22 +0300 Subject: [PATCH 03/14] Update main.yml --- .github/workflows/main.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f86b6a8..40f7dc1 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -58,9 +58,12 @@ jobs: sudo apt-get install -y intel-oneapi-compiler-fortran - name: Set up Intel environment + shell: bash run: | source /opt/intel/oneapi/setvars.sh - echo "source /opt/intel/oneapi/setvars.sh" >> $GITHUB_ENV + echo "IFORT_CONFIGURED=1" >> $GITHUB_ENV + echo "PATH=$PATH" >> $GITHUB_ENV + echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH" >> $GITHUB_ENV - name: Compile Coarray program with ifort run: | From 3711d8ab7778ef5765b6035e3789bba8e26236ef Mon Sep 17 00:00:00 2001 From: Saveliy Borisov Date: Sat, 14 Jun 2025 22:21:34 +0300 Subject: [PATCH 04/14] Update main.yml --- .github/workflows/main.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 40f7dc1..c3761c7 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -61,10 +61,16 @@ jobs: shell: bash run: | source /opt/intel/oneapi/setvars.sh - echo "IFORT_CONFIGURED=1" >> $GITHUB_ENV + echo "source /opt/intel/oneapi/setvars.sh" >> ~/.bashrc echo "PATH=$PATH" >> $GITHUB_ENV echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH" >> $GITHUB_ENV + - name: Verify installation + shell: bash + run: | + which ifort + ifort --version + - name: Compile Coarray program with ifort run: | source /opt/intel/oneapi/setvars.sh From 50d72c86d700bce0cce692a578d0965d2ae97594 Mon Sep 17 00:00:00 2001 From: Saveliy Borisov Date: Sat, 14 Jun 2025 22:30:28 +0300 Subject: [PATCH 05/14] Update main.yml --- .github/workflows/main.yml | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c3761c7..33e1ba8 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -57,27 +57,18 @@ jobs: sudo apt-get update sudo apt-get install -y intel-oneapi-compiler-fortran - - name: Set up Intel environment + - name: Compile and Run Coarray program with ifort shell: bash run: | source /opt/intel/oneapi/setvars.sh - echo "source /opt/intel/oneapi/setvars.sh" >> ~/.bashrc - echo "PATH=$PATH" >> $GITHUB_ENV - echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH" >> $GITHUB_ENV - - name: Verify installation - shell: bash - run: | + echo "--- Verifying installation ---" which ifort ifort --version - - name: Compile Coarray program with ifort - run: | - source /opt/intel/oneapi/setvars.sh + echo "--- Compiling Coarray program ---" ifort -coarray /coarray/fdtd.F90 -o fdtd - - name: Run Coarray program - run: | - source /opt/intel/oneapi/setvars.sh + echo "--- Running Coarray program ---" export FOR_COARRAY_NUM_IMAGES=4 ./fdtd From a5f9f315e9c42a451b70648c710dd24b26795e9f Mon Sep 17 00:00:00 2001 From: Saveliy Borisov Date: Sat, 14 Jun 2025 22:44:15 +0300 Subject: [PATCH 06/14] Update main.yml --- .github/workflows/main.yml | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 33e1ba8..0bfa5de 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -57,11 +57,23 @@ jobs: sudo apt-get update sudo apt-get install -y intel-oneapi-compiler-fortran - - name: Compile and Run Coarray program with ifort - shell: bash + - name: Set up Intel Environment Manually + id: setup_intel run: | - source /opt/intel/oneapi/setvars.sh + COMPILER_ROOT=$(find /opt/intel/oneapi/compiler -name "linux" | head -n 1) + COMPILER_LIBS=$(find /opt/intel/oneapi/compiler -name "lib" | head -n 1) + MPI_LIBS=$(find /opt/intel/oneapi/mpi -name "lib" | grep -v 'libfabric' | head -n 1) + LIBFABRIC_LIBS=$(find /opt/intel/oneapi/mpi -name "libfabric" | head -n 1) + + echo "Compiler binary path: $COMPILER_ROOT/bin/intel64" + echo "Compiler library path: $COMPILER_LIBS" + + echo "$COMPILER_ROOT/bin/intel64" >> $GITHUB_PATH + echo "LD_LIBRARY_PATH=$COMPILER_LIBS:$MPI_LIBS:$LIBFABRIC_LIBS" >> $GITHUB_ENV + + - name: Compile and Run Coarray program + run: | echo "--- Verifying installation ---" which ifort ifort --version @@ -72,3 +84,4 @@ jobs: echo "--- Running Coarray program ---" export FOR_COARRAY_NUM_IMAGES=4 ./fdtd + From 4f7dfa8ab6b32fdd5d94e43cf5acdd5ec0b39cd3 Mon Sep 17 00:00:00 2001 From: Saveliy Borisov Date: Sat, 14 Jun 2025 22:51:13 +0300 Subject: [PATCH 07/14] Update main.yml --- .github/workflows/main.yml | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 0bfa5de..7b1b060 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -57,23 +57,11 @@ jobs: sudo apt-get update sudo apt-get install -y intel-oneapi-compiler-fortran - - name: Set up Intel Environment Manually - id: setup_intel + - name: Compile and Run Coarray program with ifort + shell: bash run: | - COMPILER_ROOT=$(find /opt/intel/oneapi/compiler -name "linux" | head -n 1) - COMPILER_LIBS=$(find /opt/intel/oneapi/compiler -name "lib" | head -n 1) - MPI_LIBS=$(find /opt/intel/oneapi/mpi -name "lib" | grep -v 'libfabric' | head -n 1) - LIBFABRIC_LIBS=$(find /opt/intel/oneapi/mpi -name "libfabric" | head -n 1) - - echo "Compiler binary path: $COMPILER_ROOT/bin/intel64" - echo "Compiler library path: $COMPILER_LIBS" - - echo "$COMPILER_ROOT/bin/intel64" >> $GITHUB_PATH + source /opt/intel/oneapi/setvars.sh intel64 - echo "LD_LIBRARY_PATH=$COMPILER_LIBS:$MPI_LIBS:$LIBFABRIC_LIBS" >> $GITHUB_ENV - - - name: Compile and Run Coarray program - run: | echo "--- Verifying installation ---" which ifort ifort --version From 6f076ca2595116f97bfc0751a0a10818654b5ab8 Mon Sep 17 00:00:00 2001 From: Saveliy Borisov Date: Sat, 14 Jun 2025 22:55:00 +0300 Subject: [PATCH 08/14] Update main.yml --- .github/workflows/main.yml | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 7b1b060..64f36ca 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -57,19 +57,22 @@ jobs: sudo apt-get update sudo apt-get install -y intel-oneapi-compiler-fortran - - name: Compile and Run Coarray program with ifort + - name: Full Diagnostic shell: bash run: | + echo "--- Checking installation directories ---" + ls -R /opt/intel/oneapi/compiler/latest/ + + echo "--- PATH before source ---" + echo $PATH + + echo "--- Sourcing setvars.sh with explicit arch ---" source /opt/intel/oneapi/setvars.sh intel64 - - echo "--- Verifying installation ---" + echo "Exit code of setvars.sh: $?" + + echo "--- PATH after source ---" + echo $PATH + + echo "--- Running 'which ifort' ---" which ifort - ifort --version - - echo "--- Compiling Coarray program ---" - ifort -coarray /coarray/fdtd.F90 -o fdtd - - echo "--- Running Coarray program ---" - export FOR_COARRAY_NUM_IMAGES=4 - ./fdtd From aaf230b9954bfb024c89f9cc708366275c0d01d9 Mon Sep 17 00:00:00 2001 From: Saveliy Borisov Date: Sat, 14 Jun 2025 23:00:30 +0300 Subject: [PATCH 09/14] Update main.yml --- .github/workflows/main.yml | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 64f36ca..54b564d 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -57,22 +57,18 @@ jobs: sudo apt-get update sudo apt-get install -y intel-oneapi-compiler-fortran - - name: Full Diagnostic + - name: Compile and Run Coarray program with ifx shell: bash run: | - echo "--- Checking installation directories ---" - ls -R /opt/intel/oneapi/compiler/latest/ - - echo "--- PATH before source ---" - echo $PATH - - echo "--- Sourcing setvars.sh with explicit arch ---" source /opt/intel/oneapi/setvars.sh intel64 - echo "Exit code of setvars.sh: $?" - - echo "--- PATH after source ---" - echo $PATH - - echo "--- Running 'which ifort' ---" - which ifort + echo "--- Verifying installation ---" + which ifx + ifx -v + + echo "--- Compiling Coarray program ---" + ifx -coarray /coarray/fdtd.F90 -o fdtd + + echo "--- Running Coarray program ---" + export FOR_COARRAY_NUM_IMAGES=4 + ./fdtd From c69562fa1d293e58b4bc0033d26a238ea96587f4 Mon Sep 17 00:00:00 2001 From: Saveliy Borisov Date: Sat, 14 Jun 2025 23:05:38 +0300 Subject: [PATCH 10/14] Update main.yml --- .github/workflows/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 54b564d..b0b5859 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -67,8 +67,8 @@ jobs: ifx -v echo "--- Compiling Coarray program ---" - ifx -coarray /coarray/fdtd.F90 -o fdtd + ifx -coarray ${PWD}/coarray/fdtd.F90 -o fdtd echo "--- Running Coarray program ---" export FOR_COARRAY_NUM_IMAGES=4 - ./fdtd + ${PWD}/fdtd From 1f720c8a70091e7f831e274900e864611d173745 Mon Sep 17 00:00:00 2001 From: Saveliy Date: Sat, 14 Jun 2025 23:10:50 +0300 Subject: [PATCH 11/14] update fortran output --- coarray/fdtd.F90 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/coarray/fdtd.F90 b/coarray/fdtd.F90 index ac37e7f..86fbf79 100644 --- a/coarray/fdtd.F90 +++ b/coarray/fdtd.F90 @@ -267,10 +267,11 @@ end subroutine update_E_field !=============================================================== subroutine print_full_E_slice() integer :: img, ik, ij - do ik = Ni/2-5, Ni/2+5 - do ij = Nj/2-5, Nj/2+5 + do ij = Nj/2-5, Nj/2+5 + do ik = Ni/2-5, Ni/2+5 img = ceiling(real(Nk/2+1) / real(k_local)) write(*, '(F12.6)', advance='no') Ex(ik,ij,Nk/2+1 - (img - 1) * k_local)[img] +! write(*, '(F12.6)', advance='no') next_Ex(ik, ij) end do print * end do From 1980b32da888618a3d99fa37e73bfbe2ffa0adb7 Mon Sep 17 00:00:00 2001 From: Saveliy Date: Sat, 14 Jun 2025 23:57:20 +0300 Subject: [PATCH 12/14] fix currents iterations --- coarray/fdtd.F90 | 39 ++++-- coarray/fdtd.f90 | 303 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 334 insertions(+), 8 deletions(-) create mode 100644 coarray/fdtd.f90 diff --git a/coarray/fdtd.F90 b/coarray/fdtd.F90 index 86fbf79..8ad2238 100644 --- a/coarray/fdtd.F90 +++ b/coarray/fdtd.F90 @@ -24,7 +24,7 @@ program fdtd_coarray_optimized integer(int64) :: start_time, end_time, rate integer :: start_i, start_j, start_k, max_i, max_j, max_k real(8) :: elapsed_time - real(8) :: Tx, Ty, Tz, TT, bnd + real(8) :: Tx, Ty, Tz, TT, bnd, current_time ! Coarray initialization this_img = this_image() @@ -36,6 +36,7 @@ program fdtd_coarray_optimized Tx = 4 * C Ty = 4 * C Tz = 4 * C + current_time = min(int(TT / dt), num_iterations) bnd = Ni / 2.0 * dx @@ -77,9 +78,7 @@ program fdtd_coarray_optimized end if ! Main FDTD loop - do t = 1, num_iterations - if (this_img == 1) print '(A, I3)', 'Iteration ', t - + do t = 1, current_time if (this_img == 1) then call init_currents(t) end if @@ -103,6 +102,31 @@ program fdtd_coarray_optimized sync all end do + + Jx = 0.0 + Jy = 0.0 + Jz = 0.0 + sync all + + do t = current_time + 1, num_iterations + call update_B_field() + sync all + + pred_Bx(:,:) = Bx(:, :, k_local)[pred_img] + pred_By(:,:) = By(:, :, k_local)[pred_img] + sync all + + call update_E_field() + sync all + + next_Ex(:,:) = Ex(:, :, 1)[next_img] + next_Ey(:,:) = Ey(:, :, 1)[next_img] + sync all + + call update_B_field() + sync all + + end do sync all ! Final timing and cleanup @@ -267,11 +291,10 @@ end subroutine update_E_field !=============================================================== subroutine print_full_E_slice() integer :: img, ik, ij - do ij = Nj/2-5, Nj/2+5 - do ik = Ni/2-5, Ni/2+5 + do ij = Nj/2-4, Nj/2+5 + do ik = Ni/2-4, Ni/2+5 img = ceiling(real(Nk/2+1) / real(k_local)) - write(*, '(F12.6)', advance='no') Ex(ik,ij,Nk/2+1 - (img - 1) * k_local)[img] -! write(*, '(F12.6)', advance='no') next_Ex(ik, ij) + write(*, '(F12.5)', advance='no') Ex(ik,ij,Nk/2+1 - (img - 1) * k_local)[img] end do print * end do diff --git a/coarray/fdtd.f90 b/coarray/fdtd.f90 new file mode 100644 index 0000000..8ad2238 --- /dev/null +++ b/coarray/fdtd.f90 @@ -0,0 +1,303 @@ +program fdtd_coarray_optimized + use iso_fortran_env + implicit none + + ! Parameters + integer, parameter :: Ni = 32, Nj = 32, Nk = 32 + integer, parameter :: num_iterations = 100 + real(8), parameter :: C = 3e10, PI = 3.14159265358 + real(8), parameter :: dx = C, dy = C, dz = C, dt = 0.2 + real(8), parameter :: coef_B_dx = C * dt / (2 * dx), coef_B_dy = C * dt / (2 * dy), coef_B_dz = C * dt / (2 * dz) + real(8), parameter :: coef_E_dx = C * dt / dx, coef_E_dy = C * dt / dy, coef_E_dz = C * dt / dz + real(8), parameter :: coef_J = 4*PI*dt + + ! Field arrays (optimized layout for vectorization) + real(8), allocatable :: Ex(:,:,:)[:], Ey(:,:,:)[:], Ez(:,:,:)[:] + real(8), allocatable :: Bx(:,:,:)[:], By(:,:,:)[:], Bz(:,:,:)[:] + real(8), allocatable :: Jx(:,:,:)[:], Jy(:,:,:)[:], Jz(:,:,:)[:] + real(8), allocatable :: next_Ex(:,:)[:], next_Ey(:,:)[:], pred_Bx(:,:)[:], pred_By(:,:)[:] + + ! Local variables + integer :: this_img, total_imgs, next_img, pred_img + integer :: k_start, k_end, k_local + integer :: idx, t + integer(int64) :: start_time, end_time, rate + integer :: start_i, start_j, start_k, max_i, max_j, max_k + real(8) :: elapsed_time + real(8) :: Tx, Ty, Tz, TT, bnd, current_time + + ! Coarray initialization + this_img = this_image() + total_imgs = num_images() + next_img = merge(this_image() + 1, 1, this_image() < num_images()) + pred_img = merge(this_image() - 1, num_images(), this_image() > 1) + + TT = 8.0 + Tx = 4 * C + Ty = 4 * C + Tz = 4 * C + current_time = min(int(TT / dt), num_iterations) + + bnd = Ni / 2.0 * dx + + start_i = floor((-Tx/4.0 + bnd) / dx) + 1 + start_j = floor((-Ty/4.0 + bnd) / dy) + 1 + start_k = floor((-Tz/4.0 + bnd) / dz) + 1 + + max_i = floor((Tx/4.0 + bnd) / dx) + 1 + max_j = floor((Ty/4.0 + bnd) / dy) + 1 + max_k = floor((Tz/4.0 + bnd) / dz) + 1 + + ! Domain decomposition + call init_decomposition() + + ! Allocate arrays with optimized layout + allocate(Ex(Ni, Nj, k_local)[*]) + allocate(Ey(Ni, Nj, k_local)[*]) + allocate(Ez(Ni, Nj, k_local)[*]) + allocate(Bx(Ni, Nj, k_local)[*]) + allocate(By(Ni, Nj, k_local)[*]) + allocate(Bz(Ni, Nj, k_local)[*]) + allocate(Jx(Ni, Nj, k_local)[*]) + allocate(Jy(Ni, Nj, k_local)[*]) + allocate(Jz(Ni, Nj, k_local)[*]) + + allocate(next_Ex(Ni, Nj)[*]) + allocate(next_Ey(Ni, Nj)[*]) + allocate(pred_Bx(Ni, Nj)[*]) + allocate(pred_By(Ni, Nj)[*]) + + ! Initialize fields + call init_fields() + + ! Timing and output + if (this_img == 1) then + print '(A, I0)', 'Running on ', total_imgs, ' images' + call system_clock(count_rate=rate) + call system_clock(count=start_time) + end if + + ! Main FDTD loop + do t = 1, current_time + if (this_img == 1) then + call init_currents(t) + end if + sync all + + call update_B_field() + sync all + + pred_Bx(:,:) = Bx(:, :, k_local)[pred_img] + pred_By(:,:) = By(:, :, k_local)[pred_img] + sync all + + call update_E_field() + sync all + + next_Ex(:,:) = Ex(:, :, 1)[next_img] + next_Ey(:,:) = Ey(:, :, 1)[next_img] + sync all + + call update_B_field() + sync all + + end do + + Jx = 0.0 + Jy = 0.0 + Jz = 0.0 + sync all + + do t = current_time + 1, num_iterations + call update_B_field() + sync all + + pred_Bx(:,:) = Bx(:, :, k_local)[pred_img] + pred_By(:,:) = By(:, :, k_local)[pred_img] + sync all + + call update_E_field() + sync all + + next_Ex(:,:) = Ex(:, :, 1)[next_img] + next_Ey(:,:) = Ey(:, :, 1)[next_img] + sync all + + call update_B_field() + sync all + + end do + + sync all + ! Final timing and cleanup + if (this_img == 1) then + call system_clock(count=end_time) + elapsed_time = real(end_time - start_time)/real(rate) + print '(A, F0.2, A)', 'Total execution time: ', elapsed_time, ' seconds' + end if + + sync all + if ((this_image() == 1)) then !.and. (Nk <= 16)) then + call print_full_E_slice() + end if + + deallocate(Ex, Ey, Ez, Bx, By, Bz, Jx, Jy, Jz) + deallocate(next_Ex, next_Ey, pred_Bx, pred_By) + +contains + !=============================================================== + subroutine init_decomposition + integer :: remainder, offset + + remainder = mod(Nk, total_imgs) + k_local = Nk / total_imgs + + if (this_img <= remainder) then + k_local = k_local + 1 + offset = (this_img - 1)*k_local + else + offset = remainder*(k_local + 1) + (this_img - remainder - 1)*k_local + end if + + k_start = offset + 1 + k_end = offset + k_local + end subroutine init_decomposition + + !=============================================================== + subroutine init_fields + Ex = 0.0 + Ey = 0.0 + Ez = 0.0 + next_Ex = 0.0 + next_Ey = 0.0 + pred_Bx = 0.0 + pred_By = 0.0 + Bx = 0.0 + By = 0.0 + Bz = 0.0 + Jx = 0.0 + Jy = 0.0 + Jz = 0.0 + end subroutine init_fields + + !=============================================================== + subroutine init_currents(this_t) + integer, intent(in) :: this_t + integer :: i, j, k + integer :: this_cur_img + real(8) :: value + + do k = start_k, max_k + do j = start_j, max_j + do i = start_i, max_i + this_cur_img = ceiling(real(k) / real(k_local)) + value = (sin(2.0 * PI * this_t * dt / TT)) & + * (cos(2.0 * PI * (i-1) * dx / Tx)**2) & + * (cos(2.0 * PI * (j-1) * dy / Ty)**2) & + * (cos(2.0 * PI * (k-1) * dz / Tz)**2) + Jx(i,j,k - (this_cur_img - 1) * k_local)[this_cur_img] = value + Jy(i,j,k - (this_cur_img - 1) * k_local)[this_cur_img] = value + Jz(i,j,k - (this_cur_img - 1) * k_local)[this_cur_img] = value + end do + end do + end do + end subroutine init_currents + + !=============================================================== + subroutine update_B_field + integer :: ip, jp, kp + integer :: i, j, k + + do k = 1, k_local - 1 + do j = 1, Nj + jp = merge(j+1, 1, j < Nj) + do i = 1, Ni + ip = merge(i+1, 1, i < Ni) + + Bx(i,j,k) = Bx(i,j,k) + coef_B_dz * (Ey(i,j,k+1) - Ey(i,j,k)) - & + coef_B_dy * (Ez(i,jp,k) - Ez(i,j,k)) + + By(i,j,k) = By(i,j,k) + coef_B_dx * (Ez(ip,j,k) - Ez(i,j,k)) - & + coef_B_dz * (Ex(i,j,k+1) - Ex(i,j,k)) + + Bz(i,j,k) = Bz(i,j,k) + coef_B_dy * (Ex(i,jp,k) - Ex(i,j,k)) - & + coef_B_dx * (Ey(ip,j,k) - Ey(i,j,k)) + end do + end do + end do + do j = 1, Nj + jp = merge(j+1, 1, j < Nj) + do i = 1, Ni + ip = merge(i+1, 1, i < Ni) + + Bx(i,j,k_local) = Bx(i,j,k_local) + coef_B_dz * (next_Ey(i,j) - Ey(i,j,k_local)) - & + coef_B_dy * (Ez(i,jp,k_local) - Ez(i,j,k_local)) + + By(i,j,k_local) = By(i,j,k_local) + coef_B_dx * (Ez(ip,j,k_local) - Ez(i,j,k)) - & + coef_B_dz * (next_Ex(i,j) - Ex(i,j,k_local)) + + Bz(i,j,k_local) = Bz(i,j,k_local) + coef_B_dy * (Ex(i,jp,k_local) - Ex(i,j,k_local)) - & + coef_B_dx * (Ey(ip,j,k_local) - Ey(i,j,k_local)) + end do + end do + + end subroutine update_B_field + + !=============================================================== + subroutine update_E_field + integer :: im, jm, km + integer :: i, j, k + + do j = 1, Nj + jm = merge(j-1, Nj, j > 1) + do i = 1, Ni + im = merge(i-1, Ni, i > 1) + + Ex(i,j,1) = Ex(i,j,1) - coef_J * Jx(i,j,1) + & + coef_E_dy * (Bz(i,j,1) - Bz(i,jm,1)) - & + coef_E_dz * (By(i,j,1) - pred_By(i,j)) + + Ey(i,j,1) = Ey(i,j,1) - coef_J * Jy(i,j,1) + & + coef_E_dz * (Bx(i,j,1) - pred_Bx(i,j)) - & + coef_E_dx * (Bz(i,j,1) - Bz(im,j,1)) + + Ez(i,j,1) = Ez(i,j,1) - coef_J * Jz(i,j,1) + & + coef_E_dx * (By(i,j,1) - By(im,j,1)) - & + coef_E_dy * (Bx(i,j,1) - Bx(i,jm,1)) + end do + end do + do k = 2, k_local + do j = 1, Nj + jm = merge(j-1, Nj, j > 1) + do i = 1, Ni + im = merge(i-1, Ni, i > 1) + + Ex(i,j,k) = Ex(i,j,k) - coef_J * Jx(i,j,k) + & + coef_E_dy * (Bz(i,j,k) - Bz(i,jm,k)) - & + coef_E_dz * (By(i,j,k) - By(i,j,k-1)) + + Ey(i,j,k) = Ey(i,j,k) - coef_J * Jy(i,j,k) + & + coef_E_dz * (Bx(i,j,k) - Bx(i,j,k-1)) - & + coef_E_dx * (Bz(i,j,k) - Bz(im,j,k)) + + Ez(i,j,k) = Ez(i,j,k) - coef_J * Jz(i,j,k) + & + coef_E_dx * (By(i,j,k) - By(im,j,k)) - & + coef_E_dy * (Bx(i,j,k) - Bx(i,jm,k)) + end do + end do + end do + end subroutine update_E_field + + !=============================================================== +subroutine print_full_E_slice() + integer :: img, ik, ij + do ij = Nj/2-4, Nj/2+5 + do ik = Ni/2-4, Ni/2+5 + img = ceiling(real(Nk/2+1) / real(k_local)) + write(*, '(F12.5)', advance='no') Ex(ik,ij,Nk/2+1 - (img - 1) * k_local)[img] + end do + print * + end do + +end subroutine print_full_E_slice +end program fdtd_coarray_optimized From 8e02c67c97f03cdd3b648d493936a6b493378455 Mon Sep 17 00:00:00 2001 From: Saveliy Borisov Date: Sat, 14 Jun 2025 23:59:10 +0300 Subject: [PATCH 13/14] Delete coarray/fdtd.f90 --- coarray/fdtd.f90 | 303 ----------------------------------------------- 1 file changed, 303 deletions(-) delete mode 100644 coarray/fdtd.f90 diff --git a/coarray/fdtd.f90 b/coarray/fdtd.f90 deleted file mode 100644 index 8ad2238..0000000 --- a/coarray/fdtd.f90 +++ /dev/null @@ -1,303 +0,0 @@ -program fdtd_coarray_optimized - use iso_fortran_env - implicit none - - ! Parameters - integer, parameter :: Ni = 32, Nj = 32, Nk = 32 - integer, parameter :: num_iterations = 100 - real(8), parameter :: C = 3e10, PI = 3.14159265358 - real(8), parameter :: dx = C, dy = C, dz = C, dt = 0.2 - real(8), parameter :: coef_B_dx = C * dt / (2 * dx), coef_B_dy = C * dt / (2 * dy), coef_B_dz = C * dt / (2 * dz) - real(8), parameter :: coef_E_dx = C * dt / dx, coef_E_dy = C * dt / dy, coef_E_dz = C * dt / dz - real(8), parameter :: coef_J = 4*PI*dt - - ! Field arrays (optimized layout for vectorization) - real(8), allocatable :: Ex(:,:,:)[:], Ey(:,:,:)[:], Ez(:,:,:)[:] - real(8), allocatable :: Bx(:,:,:)[:], By(:,:,:)[:], Bz(:,:,:)[:] - real(8), allocatable :: Jx(:,:,:)[:], Jy(:,:,:)[:], Jz(:,:,:)[:] - real(8), allocatable :: next_Ex(:,:)[:], next_Ey(:,:)[:], pred_Bx(:,:)[:], pred_By(:,:)[:] - - ! Local variables - integer :: this_img, total_imgs, next_img, pred_img - integer :: k_start, k_end, k_local - integer :: idx, t - integer(int64) :: start_time, end_time, rate - integer :: start_i, start_j, start_k, max_i, max_j, max_k - real(8) :: elapsed_time - real(8) :: Tx, Ty, Tz, TT, bnd, current_time - - ! Coarray initialization - this_img = this_image() - total_imgs = num_images() - next_img = merge(this_image() + 1, 1, this_image() < num_images()) - pred_img = merge(this_image() - 1, num_images(), this_image() > 1) - - TT = 8.0 - Tx = 4 * C - Ty = 4 * C - Tz = 4 * C - current_time = min(int(TT / dt), num_iterations) - - bnd = Ni / 2.0 * dx - - start_i = floor((-Tx/4.0 + bnd) / dx) + 1 - start_j = floor((-Ty/4.0 + bnd) / dy) + 1 - start_k = floor((-Tz/4.0 + bnd) / dz) + 1 - - max_i = floor((Tx/4.0 + bnd) / dx) + 1 - max_j = floor((Ty/4.0 + bnd) / dy) + 1 - max_k = floor((Tz/4.0 + bnd) / dz) + 1 - - ! Domain decomposition - call init_decomposition() - - ! Allocate arrays with optimized layout - allocate(Ex(Ni, Nj, k_local)[*]) - allocate(Ey(Ni, Nj, k_local)[*]) - allocate(Ez(Ni, Nj, k_local)[*]) - allocate(Bx(Ni, Nj, k_local)[*]) - allocate(By(Ni, Nj, k_local)[*]) - allocate(Bz(Ni, Nj, k_local)[*]) - allocate(Jx(Ni, Nj, k_local)[*]) - allocate(Jy(Ni, Nj, k_local)[*]) - allocate(Jz(Ni, Nj, k_local)[*]) - - allocate(next_Ex(Ni, Nj)[*]) - allocate(next_Ey(Ni, Nj)[*]) - allocate(pred_Bx(Ni, Nj)[*]) - allocate(pred_By(Ni, Nj)[*]) - - ! Initialize fields - call init_fields() - - ! Timing and output - if (this_img == 1) then - print '(A, I0)', 'Running on ', total_imgs, ' images' - call system_clock(count_rate=rate) - call system_clock(count=start_time) - end if - - ! Main FDTD loop - do t = 1, current_time - if (this_img == 1) then - call init_currents(t) - end if - sync all - - call update_B_field() - sync all - - pred_Bx(:,:) = Bx(:, :, k_local)[pred_img] - pred_By(:,:) = By(:, :, k_local)[pred_img] - sync all - - call update_E_field() - sync all - - next_Ex(:,:) = Ex(:, :, 1)[next_img] - next_Ey(:,:) = Ey(:, :, 1)[next_img] - sync all - - call update_B_field() - sync all - - end do - - Jx = 0.0 - Jy = 0.0 - Jz = 0.0 - sync all - - do t = current_time + 1, num_iterations - call update_B_field() - sync all - - pred_Bx(:,:) = Bx(:, :, k_local)[pred_img] - pred_By(:,:) = By(:, :, k_local)[pred_img] - sync all - - call update_E_field() - sync all - - next_Ex(:,:) = Ex(:, :, 1)[next_img] - next_Ey(:,:) = Ey(:, :, 1)[next_img] - sync all - - call update_B_field() - sync all - - end do - - sync all - ! Final timing and cleanup - if (this_img == 1) then - call system_clock(count=end_time) - elapsed_time = real(end_time - start_time)/real(rate) - print '(A, F0.2, A)', 'Total execution time: ', elapsed_time, ' seconds' - end if - - sync all - if ((this_image() == 1)) then !.and. (Nk <= 16)) then - call print_full_E_slice() - end if - - deallocate(Ex, Ey, Ez, Bx, By, Bz, Jx, Jy, Jz) - deallocate(next_Ex, next_Ey, pred_Bx, pred_By) - -contains - !=============================================================== - subroutine init_decomposition - integer :: remainder, offset - - remainder = mod(Nk, total_imgs) - k_local = Nk / total_imgs - - if (this_img <= remainder) then - k_local = k_local + 1 - offset = (this_img - 1)*k_local - else - offset = remainder*(k_local + 1) + (this_img - remainder - 1)*k_local - end if - - k_start = offset + 1 - k_end = offset + k_local - end subroutine init_decomposition - - !=============================================================== - subroutine init_fields - Ex = 0.0 - Ey = 0.0 - Ez = 0.0 - next_Ex = 0.0 - next_Ey = 0.0 - pred_Bx = 0.0 - pred_By = 0.0 - Bx = 0.0 - By = 0.0 - Bz = 0.0 - Jx = 0.0 - Jy = 0.0 - Jz = 0.0 - end subroutine init_fields - - !=============================================================== - subroutine init_currents(this_t) - integer, intent(in) :: this_t - integer :: i, j, k - integer :: this_cur_img - real(8) :: value - - do k = start_k, max_k - do j = start_j, max_j - do i = start_i, max_i - this_cur_img = ceiling(real(k) / real(k_local)) - value = (sin(2.0 * PI * this_t * dt / TT)) & - * (cos(2.0 * PI * (i-1) * dx / Tx)**2) & - * (cos(2.0 * PI * (j-1) * dy / Ty)**2) & - * (cos(2.0 * PI * (k-1) * dz / Tz)**2) - Jx(i,j,k - (this_cur_img - 1) * k_local)[this_cur_img] = value - Jy(i,j,k - (this_cur_img - 1) * k_local)[this_cur_img] = value - Jz(i,j,k - (this_cur_img - 1) * k_local)[this_cur_img] = value - end do - end do - end do - end subroutine init_currents - - !=============================================================== - subroutine update_B_field - integer :: ip, jp, kp - integer :: i, j, k - - do k = 1, k_local - 1 - do j = 1, Nj - jp = merge(j+1, 1, j < Nj) - do i = 1, Ni - ip = merge(i+1, 1, i < Ni) - - Bx(i,j,k) = Bx(i,j,k) + coef_B_dz * (Ey(i,j,k+1) - Ey(i,j,k)) - & - coef_B_dy * (Ez(i,jp,k) - Ez(i,j,k)) - - By(i,j,k) = By(i,j,k) + coef_B_dx * (Ez(ip,j,k) - Ez(i,j,k)) - & - coef_B_dz * (Ex(i,j,k+1) - Ex(i,j,k)) - - Bz(i,j,k) = Bz(i,j,k) + coef_B_dy * (Ex(i,jp,k) - Ex(i,j,k)) - & - coef_B_dx * (Ey(ip,j,k) - Ey(i,j,k)) - end do - end do - end do - do j = 1, Nj - jp = merge(j+1, 1, j < Nj) - do i = 1, Ni - ip = merge(i+1, 1, i < Ni) - - Bx(i,j,k_local) = Bx(i,j,k_local) + coef_B_dz * (next_Ey(i,j) - Ey(i,j,k_local)) - & - coef_B_dy * (Ez(i,jp,k_local) - Ez(i,j,k_local)) - - By(i,j,k_local) = By(i,j,k_local) + coef_B_dx * (Ez(ip,j,k_local) - Ez(i,j,k)) - & - coef_B_dz * (next_Ex(i,j) - Ex(i,j,k_local)) - - Bz(i,j,k_local) = Bz(i,j,k_local) + coef_B_dy * (Ex(i,jp,k_local) - Ex(i,j,k_local)) - & - coef_B_dx * (Ey(ip,j,k_local) - Ey(i,j,k_local)) - end do - end do - - end subroutine update_B_field - - !=============================================================== - subroutine update_E_field - integer :: im, jm, km - integer :: i, j, k - - do j = 1, Nj - jm = merge(j-1, Nj, j > 1) - do i = 1, Ni - im = merge(i-1, Ni, i > 1) - - Ex(i,j,1) = Ex(i,j,1) - coef_J * Jx(i,j,1) + & - coef_E_dy * (Bz(i,j,1) - Bz(i,jm,1)) - & - coef_E_dz * (By(i,j,1) - pred_By(i,j)) - - Ey(i,j,1) = Ey(i,j,1) - coef_J * Jy(i,j,1) + & - coef_E_dz * (Bx(i,j,1) - pred_Bx(i,j)) - & - coef_E_dx * (Bz(i,j,1) - Bz(im,j,1)) - - Ez(i,j,1) = Ez(i,j,1) - coef_J * Jz(i,j,1) + & - coef_E_dx * (By(i,j,1) - By(im,j,1)) - & - coef_E_dy * (Bx(i,j,1) - Bx(i,jm,1)) - end do - end do - do k = 2, k_local - do j = 1, Nj - jm = merge(j-1, Nj, j > 1) - do i = 1, Ni - im = merge(i-1, Ni, i > 1) - - Ex(i,j,k) = Ex(i,j,k) - coef_J * Jx(i,j,k) + & - coef_E_dy * (Bz(i,j,k) - Bz(i,jm,k)) - & - coef_E_dz * (By(i,j,k) - By(i,j,k-1)) - - Ey(i,j,k) = Ey(i,j,k) - coef_J * Jy(i,j,k) + & - coef_E_dz * (Bx(i,j,k) - Bx(i,j,k-1)) - & - coef_E_dx * (Bz(i,j,k) - Bz(im,j,k)) - - Ez(i,j,k) = Ez(i,j,k) - coef_J * Jz(i,j,k) + & - coef_E_dx * (By(i,j,k) - By(im,j,k)) - & - coef_E_dy * (Bx(i,j,k) - Bx(i,jm,k)) - end do - end do - end do - end subroutine update_E_field - - !=============================================================== -subroutine print_full_E_slice() - integer :: img, ik, ij - do ij = Nj/2-4, Nj/2+5 - do ik = Ni/2-4, Ni/2+5 - img = ceiling(real(Nk/2+1) / real(k_local)) - write(*, '(F12.5)', advance='no') Ex(ik,ij,Nk/2+1 - (img - 1) * k_local)[img] - end do - print * - end do - -end subroutine print_full_E_slice -end program fdtd_coarray_optimized From 8e7d09be657c8f9b7dafe763f3640dda46bb2ce0 Mon Sep 17 00:00:00 2001 From: Saveliy Date: Sat, 25 Oct 2025 14:18:27 +0300 Subject: [PATCH 14/14] rename directories --- .github/workflows/main.yml | 2 +- CMakeLists.txt | 4 ++-- {samples => perf-tests}/CMakeLists.txt | 0 {samples => perf-tests}/kokkos_sample/CMakeLists.txt | 0 {samples => perf-tests}/kokkos_sample/kokkos_sample.cpp | 0 {samples => perf-tests}/sample/CMakeLists.txt | 0 {samples => perf-tests}/sample/sample.cpp | 0 {test => unit-tests}/CMakeLists.txt | 0 {test => unit-tests}/test_FDTD_method.cpp | 0 {test => unit-tests}/test_FDTD_method_kokkos.cpp | 0 {test => unit-tests}/test_main.cpp | 0 11 files changed, 3 insertions(+), 3 deletions(-) rename {samples => perf-tests}/CMakeLists.txt (100%) rename {samples => perf-tests}/kokkos_sample/CMakeLists.txt (100%) rename {samples => perf-tests}/kokkos_sample/kokkos_sample.cpp (100%) rename {samples => perf-tests}/sample/CMakeLists.txt (100%) rename {samples => perf-tests}/sample/sample.cpp (100%) rename {test => unit-tests}/CMakeLists.txt (100%) rename {test => unit-tests}/test_FDTD_method.cpp (100%) rename {test => unit-tests}/test_FDTD_method_kokkos.cpp (100%) rename {test => unit-tests}/test_main.cpp (100%) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b0b5859..d54a842 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -37,7 +37,7 @@ jobs: - name: Run tests with GCC shell: bash run: | - ${PWD}/build/test/test_FDTD_method --gtest_repeat=2 --gtest_break_on_failure + ${PWD}/build/unit-tests/test_FDTD_method --gtest_repeat=2 --gtest_break_on_failure - name: Run kokkos_sample shell: bash diff --git a/CMakeLists.txt b/CMakeLists.txt index b188d10..3115604 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -83,5 +83,5 @@ add_custom_target(create_kokkoscore ALL DEPENDS ${KOKKOS_CORE_LIB}) find_package(Kokkos REQUIRED) add_subdirectory(project) -add_subdirectory(test) -add_subdirectory(samples) +add_subdirectory(unit-tests) +add_subdirectory(perf-tests) diff --git a/samples/CMakeLists.txt b/perf-tests/CMakeLists.txt similarity index 100% rename from samples/CMakeLists.txt rename to perf-tests/CMakeLists.txt diff --git a/samples/kokkos_sample/CMakeLists.txt b/perf-tests/kokkos_sample/CMakeLists.txt similarity index 100% rename from samples/kokkos_sample/CMakeLists.txt rename to perf-tests/kokkos_sample/CMakeLists.txt diff --git a/samples/kokkos_sample/kokkos_sample.cpp b/perf-tests/kokkos_sample/kokkos_sample.cpp similarity index 100% rename from samples/kokkos_sample/kokkos_sample.cpp rename to perf-tests/kokkos_sample/kokkos_sample.cpp diff --git a/samples/sample/CMakeLists.txt b/perf-tests/sample/CMakeLists.txt similarity index 100% rename from samples/sample/CMakeLists.txt rename to perf-tests/sample/CMakeLists.txt diff --git a/samples/sample/sample.cpp b/perf-tests/sample/sample.cpp similarity index 100% rename from samples/sample/sample.cpp rename to perf-tests/sample/sample.cpp diff --git a/test/CMakeLists.txt b/unit-tests/CMakeLists.txt similarity index 100% rename from test/CMakeLists.txt rename to unit-tests/CMakeLists.txt diff --git a/test/test_FDTD_method.cpp b/unit-tests/test_FDTD_method.cpp similarity index 100% rename from test/test_FDTD_method.cpp rename to unit-tests/test_FDTD_method.cpp diff --git a/test/test_FDTD_method_kokkos.cpp b/unit-tests/test_FDTD_method_kokkos.cpp similarity index 100% rename from test/test_FDTD_method_kokkos.cpp rename to unit-tests/test_FDTD_method_kokkos.cpp diff --git a/test/test_main.cpp b/unit-tests/test_main.cpp similarity index 100% rename from test/test_main.cpp rename to unit-tests/test_main.cpp