zhenchen16 / ptychography

8 stars 8 forks source link

example not working. #2

Open AutoEM opened 2 years ago

AutoEM commented 2 years ago

Hi,

to make this work on windows I replaced the line

include <sys/sysinfo.h> with #include in the .cpp files at PtychoShelves_EM-1.0+utils\private.

In add_to_3D_projection_mex.m and the other m file in the above folder, I also changed the mex call to mex('-R2018a','-O', 'COMPFLAGS="$COMPFLAGS -fopenmp"', '-O','LDFLAGS="$LDFLAGS -fopenmp"',[path,'private/add_to_3D_projection_mex.cpp'], '-output', [path, 'private/add_to_3D_projection_mex'])

This way, I got the iterations running. However at iteration 19 or 20, I always get errors because the matrices contain NaNs. I get the same error with GPU and without it.

I am using the file rawdata_1x_crop.mat. Is there some clear mistake I have made?

My relevant files: ptychography_demo.zip

Also my ouput:

`>> prepare_data_electron Warning: Directory already exists.

ptychography_demo D:\matl\PtychoShelves_EM-1.0\ptycho\exampleData\01//MLs_L1_p2_g60_betaLSQ0.5_pc_Niter50_vp1_Npbst20_test_Ndp64_step01/ ptycho_prepare_paths [70] : Preparing paths. ptycho_prepare_paths [95] : Using default value for ptycho_matlab_path:

############################################################### ########################## DEBUG MODE ######################### ############################################################### get_queue [64] : p.queue.name is not set, using default p.queue.name = '' initial_checks [160] : p.detector.data_prefix is not defined initial_checks [189] : Using matlab APS data preparator. initial_checks [296] : run_name = S00001_128x128_b0_ML_recon ptycho_prepare_paths [144] : base_path = D:\matl\PtychoShelves_EM-1.0\ptycho\exampleData\ ptycho_prepare_paths [152] : Using default save_path ptycho_prepare_paths [158] : save_path = D:\matl\PtychoShelves_EM-1.0\ptycho\exampleData\analysis\S00000-00999\S00001\ ptycho_prepare_paths [207] : Using default prepared data path ptycho_prepare_paths [227] : prepare_data_path = D:\matl\PtychoShelves_EM-1.0\ptycho\exampleData\analysis\S00000-00999\S00001\ ptycho_prepare_paths [233] : Using default prepared data filename ptycho_prepare_paths [239] : prepare_data_filename = S00001_data_128x128.h5 load_detector [70] : Loading preferences for empad detector. check_fields [126] : read_path_format not defined for empad. Using default value. prepare_initial_guess [69] : Preparing initial guess. update_object_size [65] : Computed object size: 495 x 495 prepare_initial_object [75] : Using random object as initial guess. ptycho_model_probe [140] : Using previous run as initial probe. ptycho_model_probe [166] : Loaded probe from: D:\matl\PtychoShelves_EM-1.0\ptycho\exampleData\01\probe_initial.mat ptycho_model_probe [206] : File D:\matl\PtychoShelves_EM-1.0\ptycho\exampleData\01\probe_initial.mat loaded successfully. ptycho_prepare_scans [135] : Loading raw data prepare_data [76] : Preparing data using matlab APS data preparation. prepare_data [94] : Using supplied center: 65 65 get_center [105] : Using center: (65, 65) get_center [116] : Selected region: ('RowFrom', 1, 'RowTo', 128, 'ColumnFrom', 1, 'ColumnTo', 128) load_data [25] : Loading raw data of scan 00001. Warning: Escaped character '\m' is not valid. See 'doc sprintf' for supported special characters. load_data [39] : Loaded data from:D: matlab_aps [39] : Number of probe positions: 3600 matlab_aps [40] : Number of diffraction patterns : 3600 initialize_ptycho [185] : Finished data preparation and initialization. ptycho_recons/ptycho_call [223] : Reconstructing S00001 ptycho_recons/ptycho_call [238] : Calling engine GPU [GPU/CPU-engine] : Loading constant probe (1) [GPU/CPU-engine] : Loading constant probe (2) [GPU/CPU-engine] : Load and pad object and probe [GPU/CPU-engine] : Preparing data and masks [GPU/CPU-engine] : Initializing GPU 1 ... [GPU/CPU-engine] : GPU 1 initialized ... [GPU] : Data are not integers, cannot use compression [GPU] : Creating new modes files [GPU] : Layer 1 distance 0.001 um
[GPU] : Using original positions [GPU] : Nearfield propagation: Fresnel number/Npix 45.4 [GPU] : Creating new modes files [GPU] : Layer 2 distance 0.001 um
[GPU] : Using original positions [GPU] : Nearfield propagation: Fresnel number/Npix 45.4 [GPU] : Creating new modes files [GPU] : Layer 3 distance 0.001 um
[GPU] : Using original positions [GPU] : Nearfield propagation: Fresnel number/Npix 45.4 [GPU] : Creating new modes files [GPU] : Layer 4 distance 0.001 um
[GPU] : Using original positions [GPU] : Nearfield propagation: Fresnel number/Npix 45.4 [GPU] : Creating new modes files [GPU] : Layer 5 distance 0.001 um
[GPU] : Using original positions [GPU] : Nearfield propagation: Fresnel number/Npix 45.4 [GPU] : Creating new modes files [GPU] : Layer 6 distance 0.001 um
[GPU] : Using original positions [GPU] : Nearfield propagation: Fresnel number/Npix 45.4 [GPU] : Creating new modes files [GPU] : Layer 7 distance 0.001 um
[GPU] : Using original positions [GPU] : Nearfield propagation: Fresnel number/Npix 45.4 [GPU] : Creating new modes files [GPU] : Layer 8 distance 0.001 um
[GPU] : Using original positions [GPU] : Nearfield propagation: Fresnel number/Npix 45.4 [GPU] : Creating new modes files [GPU] : Layer 9 distance 0.001 um
[GPU] : Using original positions [GPU] : Nearfield propagation: Fresnel number/Npix 45.4 [GPU] : Creating new modes files [GPU] : Layer 10 distance 0.001 um
[GPU] : Using original positions [GPU] : Nearfield propagation: Fresnel number/Npix 45.4 [GPU] : Creating new modes files [GPU] : Layer 11 distance 0.001 um
[GPU] : Using original positions [GPU] : Nearfield propagation: Fresnel number/Npix 45.4 [GPU] : Creating new modes files [GPU] : Layer 12 distance 0.001 um
[GPU] : Using original positions [GPU] : Nearfield propagation: Fresnel number/Npix 45.4 [GPU] : Creating new modes files [GPU] : Layer 13 distance 0.001 um
[GPU] : Using original positions [GPU] : Nearfield propagation: Fresnel number/Npix 45.4 [GPU] : Creating new modes files [GPU] : Layer 14 distance 0.001 um
[GPU] : Using original positions [GPU] : Nearfield propagation: Fresnel number/Npix 45.4 [GPU] : Creating new modes files [GPU] : Layer 15 distance 0.001 um
[GPU] : Using original positions [GPU] : Nearfield propagation: Fresnel number/Npix 45.4 [GPU] : Creating new modes files [GPU] : Layer 16 distance 0.001 um
[GPU] : Using original positions [GPU] : Nearfield propagation: Fresnel number/Npix 45.4 [GPU] : Creating new modes files [GPU] : Layer 17 distance 0.001 um
[GPU] : Using original positions [GPU] : Nearfield propagation: Fresnel number/Npix 45.4 [GPU] : Creating new modes files [GPU] : Layer 18 distance 0.001 um
[GPU] : Using original positions [GPU] : Nearfield propagation: Fresnel number/Npix 45.4 [GPU] : Creating new modes files [GPU] : Layer 19 distance 0.001 um
[GPU] : Using original positions [GPU] : Nearfield propagation: Fresnel number/Npix 45.4 [GPU] : Creating new modes files [GPU] : Layer 20 distance 0.001 um
[GPU] : Using original positions [GPU] : Nearfield propagation: Fresnel number/Npix 45.4 [GPU] : Creating new modes files [GPU] : Layer 21 distance 0.001 um
[GPU] : Using original positions [GPU] : Nearfield propagation: Fresnel number/Npix 45.4 [GPU] : Creating probe [GPU] : Creating variable probe [GPU] : 11 of 17 GB RAM free [GPU] : Checking available GPU memory ID:1 [GPU] : Check GPU load [****][GPU] : ----MEMORY REPORT GPU ID:1----- Required total memory 0.16GB

GPU ID:1 Required memory 0.16GB available memory 3.38/4.29GB

verbose 3K>> `

AutoEM commented 2 years ago

oh and this related more to PtychoShelves_EM, but since its on zenodo - no comments are possible there...