CudaWaveField

Similar documents
Wave Field Library (WFL) Polygon Source Library (PSL)

2 WaveField Rel PolygonSource Rel Rel WaveField ( wfl) PolygonSource ( psl) / wfl/psl wfl/psl

FFTSS Library Version 3.0 User's Guide

07-二村幸孝・出口大輔.indd

2008chom.pdf

新版 明解C++入門編

ex01.dvi

解きながら学ぶC++入門編

64bit SSE2 SSE2 FPU Visual C++ 64bit Inline Assembler 4 FPU SSE2 4.1 FPU Control Word FPU 16bit R R R IC RC(2) PC(2) R R PM UM OM ZM DM IM R: reserved

DiMP Users Manual Yuichi Tazaki

WinHPC ppt

( CUDA CUDA CUDA CUDA ( NVIDIA CUDA I

For_Beginners_CAPL.indd

Java演習(4) -- 変数と型 --



関数のグラフを描こう

3.1 stdio.h iostream List.2 using namespace std C printf ( ) %d %f %s %d C++ cout cout List.2 Hello World! cout << float a = 1.2f; int b = 3; cout <<

解きながら学ぶC++入門編

はじめにお読みください

cpp1.dvi

joho07-1.ppt

(Version: 2017/4/18) Intel CPU 1 Intel CPU( AMD CPU) 64bit SIMD Inline Assemler Windows Visual C++ Linux gcc 2 FPU SSE2 Intel CPU do


1 C STL(1) C C C libc C C C++ STL(Standard Template Library ) libc libc C++ C STL libc STL iostream Algorithm libc STL string vector l

ex01.dvi

64bit SSE2 SSE2 FPU Visual C++ 64bit Inline Assembler 4 FPU SSE2 4.1 FPU Control Word FPU 16bit R R R IC RC(2) PC(2) R R PM UM OM ZM DM IM R: reserved

Gpci4ソフト_下位DLL_説明書3版.PDF

PC Windows 95, Windows 98, Windows NT, Windows 2000, MS-DOS, UNIX CPU

double float

untitled

Abstract Kinect for Windows RGB Kinect for Windows v Kinect for Windows v2

main.dvi

1 CUI CUI CUI 1.1 cout cin redirect.cpp #i n c l u d e <s t r i n g > 3 using namespace std ; 5 6 i n t main ( void ) 7 { 8 s t r i n g s ; 10 c

r3.dvi

2

10/ / /30 3. ( ) 11/ 6 4. UNIX + C socket 11/13 5. ( ) C 11/20 6. http, CGI Perl 11/27 7. ( ) Perl 12/ 4 8. Windows Winsock 12/11 9. JAV

応用数学特論.dvi

Quartus II ハンドブック Volume 5、セクションIV. マルチプロセッサの調整

untitled

0.45m1.00m 1.00m 1.00m 0.33m 0.33m 0.33m 0.45m 1.00m 2


untitled

新版明解C言語 実践編

(300, 150) 120 getchar() HgBox(x, y, w, h) (x, y), w, h #include <stdio.h> #include <handy.h> int main(void) { int i; double w, h; } HgO

C による数値計算法入門 ( 第 2 版 ) 新装版 サンプルページ この本の定価 判型などは, 以下の URL からご覧いただけます. このサンプルページの内容は, 新装版 1 刷発行時のものです.

Emacs ML let start ::= exp (1) exp ::= (2) fn id exp (3) ::= (4) (5) ::= id (6) const (7) (exp) (8) let val id = exp in

2008 DS T050049

1 GPU GPGPU GPU CPU 2 GPU 2007 NVIDIA GPGPU CUDA[3] GPGPU CUDA GPGPU CUDA GPGPU GPU GPU GPU Graphics Processing Unit LSI LSI CPU ( ) DRAM GPU LSI GPU

ip-leda-homepage.dvi

ORiN CAO USB (3) CAO CAO USB ORiN CAO USB 1 2 (4) CAO 3 CAO USB 4 PC OS 1 CPU:Pentium IV 2. 8GHz :512MByte Windows XP SP2 Professional ORiN2 SDK USB D

/* do-while */ #include <stdio.h> #include <math.h> int main(void) double val1, val2, arith_mean, geo_mean; printf( \n ); do printf( ); scanf( %lf, &v

280-NX702J-A0_TX-1138A-A_NX702J.indb

Slide 1



Jacques Garrigue

±é½¬£²¡§£Í£Ð£É½éÊâ

Java updated

AquesTalk プログラミングガイド

GPU.....

JAXA key

OpenCV IS Report No Report Medical Information System Labratry

A/B (2018/10/19) Ver kurino/2018/soft/soft.html A/B

Nios® II HAL API を使用したソフトウェア・サンプル集 「Modular Scatter-Gather DMA Core」

目次 目次... 1 はじめに... 3 概要... 4 サポート環境... 5 関数... 6 MEC_OpenDevice... 7 MECDevice_Release... 8 MECDevice_GetFirmVersion... 9 MECDevice_GetCoreTemperature

‚æ4›ñ

Windows (L): D:\jyugyou\ D:\jyugyou\ D:\jyugyou\ (N): en2 OK 2


Slide 1

AquesTalk for WinCE プログラミングガイド

Informatics 2010.key


tutorial_lc.dvi

GPU Computing on Business

An Introduction to OSL

1 (bit ) ( ) PC WS CPU IEEE754 standard ( 24bit) ( 53bit)

新・明解C言語 実践編

para02-2.dvi

新・明解Java入門

2 1 Web Java Android Java 1.2 6) Java Java 7) 6) Java Java (Swing, JavaFX) (JDBC) 7) OS 1.3 Java Java

IPSJ SIG Technical Report Vol.2013-HPC-138 No /2/21 GPU CRS 1,a) 2,b) SpMV GPU CRS SpMV GPU NVIDIA Kepler CUDA5.0 Fermi GPU Kepler Kepler Tesla

HPC (pay-as-you-go) HPC Web 2

MELSEC OPCサーバマニュアル

Informatics 2014

programmingII2019-v01

PDF EX S/W OS Office

(1/2) 2/45 HPC top runner application programmer PC-9801F N88-BASIC Quick BASIC + DOS ( ) BCB Windows Percolation, Event-driven MD ActionScript Flash

! 行行 CPUDSP PPESPECell/B.E. CPUGPU 行行 SIMD [SSE, AltiVec] 用 HPC CPUDSP PPESPE (Cell/B.E.) SPE CPUGPU GPU CPU DSP DSP PPE SPE SPE CPU DSP SPE 2


疎な転置推移確率行列

XMPによる並列化実装2

インテル(R) Visual Fortran Composer XE 2011 Windows版 入門ガイド

/* sansu1.c */ #include <stdio.h> main() { int a, b, c; /* a, b, c */ a = 200; b = 1300; /* a 200 */ /* b 200 */ c = a + b; /* a b c */ }


高等学校学習指導要領解説 数学編


卒 業 研 究 報 告.PDF

£Ã¥×¥í¥°¥é¥ß¥ó¥°(2018) - Âè10²ó – ¿¹à¼°¤Îɾ²Á¡§¥¢¥ë¥´¥ê¥º¥à¤Î²þÁ± –

Transcription:

CudaWaveField 2012 3 22

2 CudaWaveField Rel 1.0.0 Rel 1.0 CudaWaveField ( cwfl) / cwfl cwfl http://www.laser.ee.kansai-u.ac.jp/wavefieldtools Note Acrobat Reader

3 I CudaWaveField 9 1 11 1.1 CudaWaveField...................... 11 1.1.1....................................... 11 Windows x64...................................... 11 NVIDIA GPU...................................... 11 CUDA............................................. 11 WaveFieldLib3........................................ 11 1.1.2.................................... 11 1.1.3................................ 12 MS Visual Studio.NET (Visual Studio 2003)....................... 12 MS Visual Studio 2005.................................... 12 MS Visual Studio 2008.................................... 12 Intel C++ Compiler..................................... 12 1.1.4............................ 12............................................. 12..................................... 12................................ 12 2 CudaWaveFieldLib 15 2.1.......................................... 15 2.2.................................... 15........................................ 15............................................ 16........................................... 16 2.3 FFT...................................... 16 2.4...................... 17 2.4.1................................... 17

4 2.4.2................................... 18 2.4.3 ExactAsmProp.......................... 19 2.5............................ 19 3 23 3.1.............................. 23 3.1.1...................................... 23 void StartCWFL(iconst char* fname = NULL,int msglevel = 1,bool device- Property = true,int devicenumber = 0)..................... 23 3.1.2 CUDA................................ 23 int GetCUDADeviceCount(void)......................... 23 cudadeviceprop GetCUDADeviceInformation(int deviceid)......... 24 void CudaMallocHost(wfl::Complex* plpointer,long nx,long ny)....... 24 3.2 CudaWaveField.................................. 25 3.2.1........................... 25 CudaWaveField(void) CudaWaveField(long nxy) CudaWaveField(long nx, long ny) CudaWaveField(long nx, long ny, double pxy) CudaWaveField(long nx, long ny, double px, double py) CudaWaveField(long nx,long ny,double px,double py, double wavelength) CudaWaveField(const wfl::wavefield& wf) CudaWaveField(const wfl::fieldparam& param)................ 25 CudaWaveField(const CudaWaveField& temp)................. 26 CudaWaveField(void).............................. 26 3.2.2................................. 26 void Init(float2* d = NULL)........................... 26 Dispose(void)................................... 26 void Clear(void).................................. 26 void ThreadsOptimization(void) void ThreadsOptimization(long nx,long ny)................... 27 3.2.3...................................... 27 void CopyParam(const wfl::fieldparam& param) void CopyParam(const CudaWaveField& param) void CopyParam(const wfl::wavefield& param)................ 27 void CopyParamAll(const wfl::fieldparam& param) void CopyParamAll(const CudaWaveField& param) void CopyParamAll(const wfl::wavefield& param)............... 27

5 void CopyWinAreaData(CudaWaveField& dest)................ 27 3.2.4........................... 28 CudaWaveField& Embed(int nxy) CudaWaveField& Embed(int nx,int ny)..................... 28 CudaWaveField& Extract(int nxy) CudaWaveField& Extract(int nx,int ny)..................... 28 void AdjustNumPixel(void)........................... 28 3.2.5................................. 28 CudaWaveField& SetRect(double wx,double wy,float amp = 1.0)...... 28 CudaWaveField& SetGaussian(double r,double nn = 2.0,double amp = 1.0) 28 CudaWaveField& SetPlaneWave(wfl::Vector v,wfl::phase phs = 0.0)..... 28 CudaWaveField& SetSphericalWave(wfl::Point sphwcenter, double amp = 1.0)......................................... 29 3.2.6.................................... 29 CudaWaveField& MultiplyPlaneWave(Vector v,wfl::phase phs = 0.0) CudaWaveField& MultiplyPlaneWave(double CosA,double CosB, wfl::phase phs = 0.0)..................................... 29 CudaWaveField& AddSphericalWave(wfl::Point p) CudaWaveField& AddSphericalWave(wfl::Point p, wfl::phase phs,double a). 29 3.2.7.................................. 29 CudaWaveField& SetRandomPhase(void)................... 29 CudaWaveField& SetQuadraticPhase(double f)................ 29 3.2.8................................. 30 float2 GetDataPointer(void) const....................... 30 size t GetDataSize(void) const.......................... 30 void SetParam(wfl::FieldParam& param).................... 30 void SetBlocks(int x,int y,int z)......................... 30 dim3 GetBlocks(void)............................... 30 void SetThreads(int x,int y,int z)........................ 30 dim3 GetThreads(void).............................. 30 3.2.9 FFT................................. 31 void FakeFft(void)................................ 31 void Fft(int s, bool beforeshift = true,bool aftershift = true) void Fft(int s,cudafftplan cuplan,bool beforeshift = true,bool aftershift = true)......................................... 31 void SwitchFs (void)............................... 31 CudaWaveField& RawScaledFft(double s,double t).............. 31 3.2.10....................................... 31

6 CudaWaveField& Rotate(const CudaWaveField& source, wfl::rmatrix& crmat, wfl::sfrequency c)............................. 31 CudaWaveField& RotateFs(wfl::Rmatrix& crmat,cudawavefield& cpfb,double2 offset)................................ 32 3.2.11....................................... 32 void AsmProp(double d)............................. 32 void AsmPropFs(double d)............................ 32 void RawAsmProp(double d)........................... 32 void RawAsmPropFs(double d)......................... 32 CudaWaveField& ExactAsmProp(double d).................. 32 CudaWaveField& ShiftedAsmProp(const CudaWaveField& source,int precision = 1)...................................... 32 CudaWaveField& FourierProp(double f).................... 33 CudaWaveField& BackFourierProp(double f)................. 33 CudaWaveField& ShiftedFresnelProp(const CudaWaveField& source) CudaWaveField& ShiftedFresnelProp(CudaWaveField& source, CudaShiftedFresnelPropDesc& csfpd)...................... 33 CudaWaveField& ShiftedFresnelPropAdd(CudaWaveField& source, CudaShiftedFresnelPropDesc& csfpd)...................... 33 CudaWaveField& ShiftedFresnelPropEx(CudaWaveField& source)...... 33 CudaWaveField& ShiftedFresnelPropAddEx(CudaWaveField& source)... 33 3.2.12......................................... 34 void PaintTriangle(const wfl::pointarray& p, float2 amp,bool memset)... 34 PaintPolygonShape(const wfl::pointarray& p,float2 amp).......... 34 3.2.13................................. 34 double MaxReduction(void)........................... 34 double2 MaxMinRedution(void)......................... 34 void Normalize(double amp = 1.0)....................... 34 3.2.14....................................... 34 void AddFrom(CudaWaveField& target).................... 34 3.2.15................................ 35

7 CudaWaveField& operator=(const CudaWaveField& cwf) CudaWaveField& operator+(const CudaWaveField& cwf) CudaWaveField& operator+=(const CudaWaveField& cwf) CudaWaveField& operator-(const CudaWaveField& cwf) CudaWaveField& operator-=(const CudaWaveField& cwf) CudaWaveField& operator (const CudaWaveField& cwf) CudaWaveField& operator =(const CudaWaveField& cwf) CudaWaveField& operator/(const CudaWaveField& cwf) CudaWaveField& operator/=(const CudaWaveField& cwf).......... 35 CudaWaveField& operator = (double val) CudaWaveField& opeartor = (const wfl::complexdouble& val) CudaWaveField& operator/= (double val) CudaWaveField& operator/= (const wfl::complexdouble& val) CudaWaveField& operator+= (const wfl::complexdouble& val) CudaWaveField& operator-=(const wfl::complexdouble& val)........ 35 void operator>> (wfl::wavefield& target) CudaWaveField& operator<< (const wfl::wavefield& wf).......... 35

I CudaWaveField

11 1 1.1 CudaWaveField 1.1.1 NVIDIA GPU WaveField Windows x64 64bit 32bit Windows NVIDIA GPU Compute Capability 2.0 GPU 1.3 GPU CUDA NVIDIA GPU CUDA CUDA CUDA CUDA CUDA Toolkit GPU Computing SDK WaveFieldLib3 WaveFieldLib3(WFL3) WFL3 1.1.2 WFL3 CUDA WFL CUDA

12 1 1.1.3 WaveField MS Visual Studio.NET (Visual Studio 2003) MS Visual Studio 2005 MS Visual Studio 2008 IntelliSense 64 CPU (64 Visual Studio ) Intel C++ Compiler 1.1.4 WaveField < >=c:\wavefieldtools < >\include\ < >\include\cwfl\ *.h WaveField < >\lib\ cwfl.lib WaveField PATH (.exe ) < >\bin\

1.1 CudaWaveField 13 cwfl.dll

15 2 CudaWaveFieldLib 2.1 CudaWaveField WaveField GPU WaveField WaveField CudaWaveField WaveField WaveField 2.2 CudaWaveField Example # include <cwfl.h> using namespace wfl ; using namespace cwfl ; int main ( void ) { StartCWFL (); /* ----- -----*/ } return 0; cwfl.h CudaWaveField cwfl.h cwfl.h wfl3.h wfl3.h

16 2 CudaWaveFieldLib CudaWaveField cwfl cwfl CudaWaveField StartCWFL() Note StartCWFL() wfl::start() StartCWFL() Start() cwfl.lib ( wfl3.lib ) PATH (*.EXE) cwfl.dll ( wfl3.dll ) 2.3 FFT 1[cm]. Example FFT (: ExRectApertureFFT.cpp) # include <cwfl.h> using namespace std ; using namespace wfl ; using namespace cwfl ; int main ( void ) { // C W F L StartCWFL ("./ FFT / FFT_test. log ",1,true,0); // EventTimer timer ; timer. Start (); // 512 x 512 1 [ mm] G P U CudaWaveField cwf (512, 512, 1e -3); // 1[ cm] x 1[ cm] cwf. SetRect (0.01,0.01); // cwf. Fft ( -1); // cwf. Normalize (); // timer. Stop (); Printf (" GPU Elapsed time = %f[ms ]\n",timer. GetTime ()); // G P U C P U WaveField wf; cwf >> wf; // b m p wf. SaveAsBmp ("./ FFT /[ GPU ] RectFFT_AMPLITUDE. bmp ",AMPLITUDE, COLOR );

2.4 17 } return 0; WaveField WaveField CudaWaveField SetRect() 1cm 1cm Fft() Normalize(). wfl::wavefield.. GPU CPU GPU! 2.1 2.4 2.4.1 CudaWaveField Example (: ExShortProp.cpp) # include <cwfl.h> using namespace std ; using namespace wfl ; using namespace cwfl ; int main ( void ) { // C W F L StartCWFL ("./ AsmProp / AsmProp. log ",1,true,0); //

18 2 CudaWaveFieldLib CudaWaveField cwf (256,256,2e -6); // cwf. SetGaussian (0.1e -3,50); // 1 m m cwf. AsmProp (1e -3); // cwf. Normalize (); // WaveField saver ; cwf >> saver ; } // saver. SaveAsBmp ("./ AsmProp / Diffraction. bmp ",AMPLITUDE ); return 0; SetGaussian() AsmProp() 2.2! "$#%'&)(+*-,./0132 546 7 2.2 2.4.2 1mm 10mm 30mm Example (: ExLongProp.cpp) # include <cwfl.h> using namespace std ; using namespace wfl ; using namespace cwfl ;

2.5 19 int main ( void ) { StartCWFL ("./ AsmProp / AsmProp2. log ",1,true,0); CudaWaveField aperture (256,256,2e -6); aperture. SetGaussian (0.1e -3,50); for ( int i = 1; i <= 3; i ++) { CudaWaveField dest ( aperture ); // W a v e F i e l d double d = 10e -3 * i; dest. AsmProp (d); char filename [128]; sprintf ( filename," Diffraction -%d. bmp ",( int )(d / 1e -3)); dest. Normalize (); } WaveField saver ; dest >> saver ; saver. SaveAsBmp ( filename, AMPLITUDE ); } return 0; 2.3 AsmProp() ExactAsmProp() 2.3 AsmProp() (a)10mm (b)20mm (3)30mm 2.4.3 ExactAsmProp AsmProp() ExactAsmProp() 2.4 ExactAsmProp() 4 2.5 CudaWaveField. Example (: ExImageFormationByLens.cpp)

20 2 CudaWaveFieldLib 2.4 ExactAsmProp() # include <cwfl.h> using namespace std ; using namespace wfl ; using namespace cwfl ; int main ( void ) { // /////////// /////////// StartCWFL (); // FieldParam :: SetDefault (128,128,2e -6); // double R = 1e -3; // WaveField saver ; // W F // /////// ///////// WaveField temp ; // W F // b m p temp. LoadBmp ("./ EyeSimulation / lena128x128. bmp ",AMPLITUDE ); CudaWaveField source = temp ; // source. Embed (3); //8 6 4 // //////// ////////// CudaWaveField lens ; // C W F lens. Embed (3); // 64 lens. SetGaussian (R,100); // lens. SetQuadraticPhase (10e -3); // 10 m m lens >> saver ; // CWF -> W F saver. SaveAsWf ("./ EyeSimulation / lens.wf"); // W F // ////////// -> //////// source. AsmProp (20e -3); // (20 mm) // ////////// ////////////////// lens *= source ; // source. Dispose (); // s o u r c e // ///////// -> /////// lens. AsmProp (20e -3); // (20 mm) // ///////// //////////////// CudaWaveField & screen = lens ; // screen. Extract (3); // 64 ( ) screen. Normalize (); // // ///////// /////////// screen >> saver ; // G P U C P U saver. SaveAsBmp ("./ EyeSimulation / image. bmp ",AMPLITUDE ); // } return 0;

2.5 21 FieldParam::SetDefault() CudaWaveField WaveField 2.5 2.5

23 3 3.1 3.1.1 WaveField void StartCWFL(iconst char* fname = NULL,int msglevel = 1,bool deviceproperty = true,int devicenumber = 0) CudaWaveField fname msglevel deviceproperty GPU devicenumber (GPU) ID Note CudaWaveFieldLib 0 3 0 3.1.2 CUDA int GetCUDADeviceCount(void) GPU PC GPU(CUDA ) Note

24 3 PC CUDA CWFL cudadeviceprop GetCUDADeviceInformation(int deviceid) cudadeviceprop deviceid ( ComputeCapability ) cudadeviceprop CUDA4.0 void CudaMallocHost(wfl::Complex* plpointer,long nx,long ny) nx * ny * sizeof(complex) CUDA CPU plpointer CudaWaveField Init() Example // ( C P U ) float2 * host_memory ; // G P U CudaMallocHost ( static_cast < wfl :: Complex * >( host_memory ),1024,1024); // C W F CudaWaveField cwf (1024,1024); // C W F cwf. Init ( host_memory ); // C W F

3.2 CudaWaveField 25 3.2 CudaWaveField 3.2.1 CudaWaveField(void) CudaWaveField(long nxy) CudaWaveField(long nx, long ny) CudaWaveField(long nx, long ny, double pxy) CudaWaveField(long nx, long ny, double px, double py) CudaWaveField(long nx,long ny,double px,double py, double wavelength) CudaWaveField(const wfl::wavefield& wf) CudaWaveField(const wfl::fieldparam& param) 1 2 Note x y nxy 3 x nx y nx x y p [ :m] 4 x y px py 5 wavelength [ :m] 6 wfl::wavefield CPU GPU 7 wfl::fieldparam () N x = N y = 256 P x = P y = 1µm λ = 632.8nm wfl::fieldparam::setdefault*** 2 2 2 Example // CudaWaveField cwf1 ; //512 x 5 1 2 CudaWaveField cwf2 (512); // 1024 x 1 0 2 4 x y 1 0 u m CudaWaveField cwf3 (1024, 1024, 10e -6);

26 3 // 2048 x 2 0 4 8 x 5 u m y 1 0 u m CudaWaveField cwf3 (2048, 2048, 5e -6, 10e -6); // W a v e F i e l d C W F wfl :: WaveField wf1 (1024,1024); CudaWaveField cwf4 ( wf1 ); // wfl :: F i e l d P a r a m C W F wfl :: FieldParam param (4096,4096); CudaWaveField cwf5 ( param ); CudaWaveField(const CudaWaveField& temp) ~CudaWaveField(void) GPU 3.2.2 void Init(float2* d = NULL) CudaWaveField GPU d Dispose(void) GPU (Init() NULL ) void Clear(void) 0

3.2 CudaWaveField 27 void ThreadsOptimization(void) void ThreadsOptimization(long nx,long ny) CudaWaveField 1 CudaWaveField nx,ny 2 nx,ny 3.2.3 void CopyParam(const wfl::fieldparam& param) void CopyParam(const CudaWaveField& param) void CopyParam(const wfl::wavefield& param) nx,ny void CopyParamAll(const wfl::fieldparam& param) void CopyParamAll(const CudaWaveField& param) void CopyParamAll(const wfl::wavefield& param) nx,ny void CopyWinAreaData(CudaWaveField& dest) dest Window dest Window

28 3 3.2.4 CudaWaveField& Embed(int nxy) CudaWaveField& Embed(int nx,int ny) 1 2 nxy 2 2 nx 2 ny 0 CudaWaveField& Extract(int nxy) CudaWaveField& Extract(int nx,int ny) 1 2 1 / nxy 2 2 1 / nx 2 1 / ny void AdjustNumPixel(void) 2 3.2.5 CudaWaveField& SetRect(double wx,double wy,float amp = 1.0) wx wy amp CudaWaveField& SetGaussian(double r,double nn = 2.0,double amp = 1.0) r nn amp CudaWaveField& SetPlaneWave(wfl::Vector v,wfl::phase phs = 0.0) v phs

3.2 CudaWaveField 29 CudaWaveField& SetSphericalWave(wfl::Point sphwcenter, double amp = 1.0) sphwcenter amp (CudaWaveField::GetOrigin() ) 3.2.6 CudaWaveField& MultiplyPlaneWave(Vector v,wfl::phase phs = 0.0) CudaWaveField& MultiplyPlaneWave(double CosA,double CosB, wfl::phase phs = 0.0) 1 v phs 2 x CosA y CosB phs CudaWaveField& AddSphericalWave(wfl::Point p) CudaWaveField& AddSphericalWave(wfl::Point p, wfl::phase phs,double a) 1 0 1 p 2 phs a p 3.2.7 CudaWaveField& SetRandomPhase(void) CudaWaveField& SetQuadraticPhase(double f) f 2

30 3 3.2.8 float2 GetDataPointer(void) const float2 CudaWaveField GPU CPU size t GetDataSize(void) const size t size t [byte] void SetParam(wfl::FieldParam& param) wfl::fieldparam void SetBlocks(int x,int y,int z) dim3 GetBlocks(void) dim3 CUDA dim3 void SetThreads(int x,int y,int z) dim3 GetThreads(void) dim3 CUDA dim3

3.2 CudaWaveField 31 3.2.9 FFT void FakeFft(void) void Fft(int s, bool beforeshift = true,bool aftershift = true) void Fft(int s,cudafftplan cuplan,bool beforeshift = true,bool aftershift = true) 1 s(-1 1 ) beforeshift,aftershift ( ) 2 CudaFFTPlan FFT CudaFFTPlan void SwitchFs (void) CudaWaveField& RawScaledFft(double s,double t) ScaledFFT 3.2.10 CudaWaveField& Rotate(const CudaWaveField& source, wfl::rmatrix& crmat, wfl::sfrequency c) source wfl::rmatrix crmat wfl::sfrequency c NULL c

32 3 CudaWaveField& RotateFs(wfl::Rmatrix& crmat,cudawavefield& cpfb,double2 offset) 3.2.11 void AsmProp(double d) d[m] void AsmPropFs(double d) d[m] void RawAsmProp(double d) d[m] void RawAsmPropFs(double d) d[m] CudaWaveField& ExactAsmProp(double d) d[m] 4 CudaWaveField& ShiftedAsmProp(const CudaWaveField& source,int precision = 1) source source

3.2 CudaWaveField 33 CudaWaveField& FourierProp(double f) f. CudaWaveField& BackFourierProp(double f) f CudaWaveField& ShiftedFresnelProp(const CudaWaveField& source) CudaWaveField& ShiftedFresnelProp(CudaWaveField& source, CudaShiftedFresnelPropDesc& csfpd) 1 source 2 CudaShiftedFresnelPropDesc CudaWaveField& ShiftedFresnelPropAdd(CudaWaveField& source, CudaShiftedFresnelPropDesc& csfpd) source. CudaWaveField& ShiftedFresnelPropEx(CudaWaveField& source) source CudaWaveField& ShiftedFresnelPropAddEx(CudaWaveField& source) source.

34 3 3.2.12 void PaintTriangle(const wfl::pointarray& p, float2 amp,bool memset) p amp memset PaintPolygonShape(const wfl::pointarray& p,float2 amp) p amp 3.2.13 double MaxReduction(void) double double2 MaxMinRedution(void) double2 double2 CUDA double.x double.y void Normalize(double amp = 1.0) amp 3.2.14 void AddFrom(CudaWaveField& target) target

3.2 CudaWaveField 35 3.2.15 CudaWaveField& operator=(const CudaWaveField& cwf) CudaWaveField& operator+(const CudaWaveField& cwf) CudaWaveField& operator+=(const CudaWaveField& cwf) CudaWaveField& operator-(const CudaWaveField& cwf) CudaWaveField& operator-=(const CudaWaveField& cwf) CudaWaveField& operator (const CudaWaveField& cwf) CudaWaveField& operator =(const CudaWaveField& cwf) CudaWaveField& operator/(const CudaWaveField& cwf) CudaWaveField& operator/=(const CudaWaveField& cwf) CWF CudaWaveField& operator = (double val) CudaWaveField& opeartor = (const wfl::complexdouble& val) CudaWaveField& operator/= (double val) CudaWaveField& operator/= (const wfl::complexdouble& val) CudaWaveField& operator+= (const wfl::complexdouble& val) CudaWaveField& operator-=(const wfl::complexdouble& val) double Real Imaginary val wfl::complexdouble void operator>> (wfl::wavefield& target) CudaWaveField& operator<< (const wfl::wavefield& wf) 1 CudaWaveField WaveField 2 WaveField CudaWaveField CudaWaveField CudaWaveField HDD CudaWaveField. Example CudaWaveField cwf1 ;

36 3 WaveField temp ; // c w f 1 cwf1 >> temp ; temp. SaveAsWf (" cwf1.wf"); //(ex. ) temp. LoadBmp (" lena. bmp ",AMPLITUDE ); cwf1 << temp ; Note WaveField CPU CudaWaveField GPU PCI-E PCI-E ( )