-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'issue3_missing-phi-diffusion-code'
- Loading branch information
Showing
7 changed files
with
459 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -84,6 +84,9 @@ performance and optimization of a specific application. CUDA hardware can be | |
emulated on the CPU using the MCUDA_ framework. Proof-of-concept | ||
trials on GPU and KNL hardware can be run on Amazon's EC2_, | ||
Rescale's ScaleX_, and equivalent HPC cloud computing platforms. | ||
Most of the current generation of research supercomputers contain GPU or KNL | ||
accelerator hardware, including Argonne National Labs' | ||
Bebop_, NERSC Cori_, TACC Stampede2_, and XSEDE_. | ||
|
||
=============== | ||
Basic Algorithm | ||
|
@@ -311,7 +314,7 @@ Work in Progress | |
- [ ] ripening | ||
- [ ] KNL | ||
- [ ] OpenMP | ||
- [ ] diffusion | ||
- [x] diffusion | ||
- [ ] spinodal | ||
- [ ] dendrite | ||
- [ ] ripening | ||
|
@@ -337,43 +340,47 @@ intended to imply that the entities, materials, or equipment are necessarily | |
the best available for the purpose. | ||
|
||
.. _`Trevor Keller`: mailto::[email protected] | ||
.. _`National Institute of Standards and Technology`: http://www.nist.gov | ||
.. _`Source on GitHub`: https://github.com/usnistgov/hiperc | ||
.. _`hiperc_guide.pdf`: doc/hiperc_guide.pdf | ||
.. |`initial conc`| image:: common-diffusion/diffusion.00000.png | ||
.. |`final conc`| image:: common-diffusion/diffusion.10000.png | ||
.. |Source on GitHub| image:: https://assets-cdn.github.com/favicon.ico | ||
.. _`Source on GitHub`: https://github.com/usnistgov/hiperc | ||
.. |Documentation on readthedocs| image:: http://readthedocs.org/projects/hiperc/badge/?version=latest | ||
.. _`Documentation on readthedocs`: http://hiperc.readthedocs.io/en/latest/?badge=latest | ||
.. |Conversation on Gitter| image:: https://badges.gitter.im/usnistgov/hiperc.svg | ||
.. _Bebop: http://www.lcrc.anl.gov/systems/resources/bebop/ | ||
.. _ccNUMA: https://en.wikipedia.org/wiki/Non-uniform_memory_access#Cache_coherent_NUMA | ||
.. _`Conversation on Gitter`: https://gitter.im/usnistgov/hiperc?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=body_badge | ||
.. |Conversation on Gitter| image:: https://badges.gitter.im/usnistgov/hiperc.svg | ||
.. _`Contributing Guidelines`: CONTRIBUTING.md | ||
.. _`file an issue`: https://github.com/usnistgov/hiperc/issues | ||
.. _OpenACC: https://www.openacc.org/ | ||
.. _radeontop: https://github.com/clbr/radeontop | ||
.. _ccNUMA: https://en.wikipedia.org/wiki/Non-uniform_memory_access#Cache_coherent_NUMA | ||
.. _convolution: https://en.wikipedia.org/wiki/Discrete_Laplace_operator#Image_Processing | ||
.. _Cori: http://www.nersc.gov/users/computational-systems/cori/ | ||
.. _Cray: http://www.cray.com/ | ||
.. _CUDA: https://developer.nvidia.com/cuda-zone | ||
.. |Documentation on readthedocs| image:: http://readthedocs.org/projects/hiperc/badge/?version=latest | ||
.. _`Documentation on readthedocs`: http://hiperc.readthedocs.io/en/latest/?badge=latest | ||
.. _Doxygen: http://www.stack.nl/~dimitri/doxygen/ | ||
.. _EC2: https://aws.amazon.com/ec2/Elastic-GPUs/ | ||
.. _`file an issue`: https://github.com/usnistgov/hiperc/issues | ||
.. |`final conc`| image:: common-diffusion/diffusion.10000.png | ||
.. _Gitter: https://gitter.im/usnistgov/hiperc | ||
.. _GNU: https://gcc.gnu.org/ | ||
.. _`hiperc_guide.pdf`: doc/hiperc_guide.pdf | ||
.. _htop: http://hisham.hm/htop/ | ||
.. |`initial conc`| image:: common-diffusion/diffusion.00000.png | ||
.. _`intel_gpu_top`: https://github.com/ChrisCummins/intel-gpu-tools | ||
.. _KNC: https://ark.intel.com/products/codename/57721/Knights-Corner | ||
.. _KNL: https://ark.intel.com/products/codename/48999/Knights-Landing | ||
.. _LaTeX: https://www.latex-project.org/ | ||
.. _Make: https://www.gnu.org/software/make/ | ||
.. _MCUDA: http://impact.crhc.illinois.edu/mcuda.aspx | ||
.. _MIMD: https://en.wikipedia.org/wiki/MIMD | ||
.. _`National Institute of Standards and Technology`: http://www.nist.gov | ||
.. _nvidia-smi: https://developer.nvidia.com/nvidia-system-management-interface | ||
.. _OpenACC: https://www.openacc.org/ | ||
.. _OpenCL: https://www.khronos.org/opencl/ | ||
.. _OpenMP: http://www.openmp.org/ | ||
.. _PGI: http://www.pgroup.com/ | ||
.. _POSIX: http://www.opengroup.org/austin/papers/posix_faq.html | ||
.. _radeontop: https://github.com/clbr/radeontop | ||
.. _ScaleX: http://www.rescale.com/products/ | ||
.. _SIMD: https://en.wikipedia.org/wiki/SIMD | ||
.. |Source on GitHub| image:: https://assets-cdn.github.com/favicon.ico | ||
.. _`Source on GitHub`: https://github.com/usnistgov/hiperc | ||
.. _Stampede2: https://www.tacc.utexas.edu/systems/stampede2 | ||
.. _`Threading Building Blocks`: https://www.threadingbuildingblocks.org/ | ||
.. _`Xeon Phi`: https://www.intel.com/content/www/us/en/products/processors/xeon-phi/xeon-phi-processors.html | ||
.. _XSEDE: https://www.xsede.org/ecosystem/resources | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# Makefile for HiPerC diffusion code | ||
# Xeon Phi implementation | ||
|
||
CC = icc | ||
CFLAGS = -O3 -openmp -xmic-avx512 -I../common-diffusion | ||
QOPT = -qopt-prefetch=3 -qopt-report=4 -qopt-report-file="qopt.log" | ||
LINKS = -lpng | ||
# QOFF = -qoffload-arch=mic-avx512 # Only activate if offloading to KNL coprocessor | ||
|
||
OBJS = boundaries.o discretization.o mesh.o numerics.o output.o timer.o | ||
|
||
# Executable | ||
diffusion: phi_main.c $(OBJS) | ||
$(CC) $(CFLAGS) $(OBJS) -include omp.h $< -o $@ $(QOPT) $(LINKS) | ||
|
||
# Xeon Phi objects | ||
boundaries.o: phi_boundaries.c | ||
$(CC) $(CFLAGS) -c $< -o $@ | ||
|
||
discretization.o: phi_discretization.c | ||
$(CC) $(CFLAGS) -c $< -o $@ | ||
|
||
# Common objects | ||
mesh.o: ../common-diffusion/mesh.c | ||
$(CC) $(CFLAGS) -c $< -o $@ | ||
|
||
numerics.o: ../common-diffusion/numerics.c | ||
$(CC) $(CFLAGS) -c $< -o $@ | ||
|
||
output.o: ../common-diffusion/output.c | ||
$(CC) $(CFLAGS) -c $< -o $@ | ||
|
||
timer.o: ../common-diffusion/timer.c | ||
$(CC) $(CFLAGS) -c $< -o $@ | ||
|
||
# Helper scripts | ||
.PHONY: run | ||
run: diffusion | ||
/usr/bin/time -f' Time (%E wall, %U user, %S sys)' ./diffusion ../common-diffusion/params.txt | ||
|
||
.PHONY: cleanobjects | ||
cleanobjects: | ||
rm -f diffusion *.o | ||
|
||
.PHONY: cleanoutputs | ||
cleanoutputs: | ||
rm -f diffusion.*.csv diffusion.*.png runlog.csv | ||
|
||
.PHONY: clean | ||
clean: cleanobjects | ||
|
||
.PHONY: cleanall | ||
cleanall: cleanobjects cleanoutputs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
/********************************************************************************** | ||
HiPerC: High Performance Computing Strategies for Boundary Value Problems | ||
written by Trevor Keller and available from https://github.com/usnistgov/hiperc | ||
This software was developed at the National Institute of Standards and Technology | ||
by employees of the Federal Government in the course of their official duties. | ||
Pursuant to title 17 section 105 of the United States Code this software is not | ||
subject to copyright protection and is in the public domain. NIST assumes no | ||
responsibility whatsoever for the use of this software by other parties, and makes | ||
no guarantees, expressed or implied, about its quality, reliability, or any other | ||
characteristic. We would appreciate acknowledgement if the software is used. | ||
This software can be redistributed and/or modified freely provided that any | ||
derivative works bear some notice that they are derived from it, and any modified | ||
versions bear some notice that they have been modified. | ||
Questions/comments to Trevor Keller ([email protected]) | ||
**********************************************************************************/ | ||
|
||
|
||
/** | ||
\file phi_boundaries.c | ||
\brief Implementation of boundary condition functions with OpenMP threading | ||
*/ | ||
|
||
#include <math.h> | ||
#include <omp.h> | ||
#include "boundaries.h" | ||
|
||
void set_boundaries(fp_t bc[2][2]) | ||
{ | ||
fp_t clo = 0.0, chi = 1.0; | ||
bc[0][0] = clo; /* bottom boundary */ | ||
bc[0][1] = clo; /* top boundary */ | ||
bc[1][0] = chi; /* left boundary */ | ||
bc[1][1] = chi; /* right boundary */ | ||
} | ||
|
||
void apply_initial_conditions(fp_t** conc, int nx, int ny, int nm, fp_t bc[2][2]) | ||
{ | ||
#pragma omp parallel | ||
{ | ||
int i, j; | ||
|
||
#pragma omp for collapse(2) | ||
for (j = 0; j < ny; j++) | ||
for (i = 0; i < nx; i++) | ||
conc[j][i] = bc[0][0]; | ||
|
||
#pragma omp for collapse(2) | ||
for (j = 0; j < ny/2; j++) | ||
for (i = 0; i < 1+nm/2; i++) | ||
conc[j][i] = bc[1][0]; /* left half-wall */ | ||
|
||
#pragma omp for collapse(2) | ||
for (j = ny/2; j < ny; j++) | ||
for (i = nx-1-nm/2; i < nx; i++) | ||
conc[j][i] = bc[1][1]; /* right half-wall */ | ||
} | ||
} | ||
|
||
void apply_boundary_conditions(fp_t** conc, int nx, int ny, int nm, fp_t bc[2][2]) | ||
{ | ||
#pragma omp parallel | ||
{ | ||
int i, ihi, ilo, j, jhi, jlo, offset; | ||
|
||
/* apply fixed boundary values: sequence does not matter */ | ||
|
||
#pragma omp for collapse(2) private(i,j) | ||
for (j = 0; j < ny/2; j++) { | ||
for (i = 0; i < 1+nm/2; i++) { | ||
conc[j][i] = bc[1][0]; /* left value */ | ||
} | ||
} | ||
|
||
#pragma omp for collapse(2) private(i,j) | ||
for (j = ny/2; j < ny; j++) { | ||
for (i = nx-1-nm/2; i < nx; i++) { | ||
conc[j][i] = bc[1][1]; /* right value */ | ||
} | ||
} | ||
|
||
/* apply no-flux boundary conditions: inside to out, sequence matters */ | ||
|
||
for (offset = 0; offset < nm/2; offset++) { | ||
ilo = nm/2 - offset; | ||
ihi = nx - 1 - nm/2 + offset; | ||
#pragma omp for private(j) | ||
for (j = 0; j < ny; j++) { | ||
conc[j][ilo-1] = conc[j][ilo]; /* left condition */ | ||
conc[j][ihi+1] = conc[j][ihi]; /* right condition */ | ||
} | ||
} | ||
|
||
for (offset = 0; offset < nm/2; offset++) { | ||
jlo = nm/2 - offset; | ||
jhi = ny - 1 - nm/2 + offset; | ||
#pragma omp for private(i) | ||
for (i = 0; i < nx; i++) { | ||
conc[jlo-1][i] = conc[jlo][i]; /* bottom condition */ | ||
conc[jhi+1][i] = conc[jhi][i]; /* top condition */ | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.