kklmn / xrt

Package xrt (XRayTracer) is a python software library for ray tracing and wave propagation in x-ray regime. It is primarily meant for modeling synchrotron sources, beamlines and beamline elements.
MIT License
83 stars 29 forks source link

Report an error when set useTT is true for using elastic deformation in crystal reflectivity #190

Open ihepzyguo opened 1 month ago

ihepzyguo commented 1 month ago

Win11, Winpython64-3.12.4.1, Spyder 5.5.5, xrt-1.6.0 Run example in xrt-master\examples\withRaycing\06_AnalyzerBent1D\01B_BentTT.py When set useTT is True, the following error message appears:

图片2 Exception in thread Thread-1: Traceback (most recent call last): File "D:\WinPython\WPy64-31241\python-3.12.4.amd64\Lib\threading.py", line 1073, in _bootstrap_inner self.run() File "D:\WinPython\WPy64-31241\python-3.12.4.amd64\Lib\site-packages\xrt-1.6.0-py3.12.egg\xrt\multipro.py", line 265, in run raycing_output = raycing.run.run_process(self.card.beamLine) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\WinPython\WPy64-31241\xrt-master\examples\withRaycing\06_AnalyzerBent1D\01B_BentTT.py", line 92, in run_process beamLine.analyzer.reflect(beamSource) File "D:\WinPython\WPy64-31241\python-3.12.4.amd64\Lib\site-packages\xrt-1.6.0-py3.12.egg\xrt\backends\raycing\oes_base.py", line 1152, in reflect self._reflect_local(good, lb, gb, File "D:\WinPython\WPy64-31241\python-3.12.4.amd64\Lib\site-packages\xrt-1.6.0-py3.12.egg\xrt\backends\raycing\oes_base.py", line 2141, in _reflect_local refl = matSur.get_amplitude_pytte( ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\WinPython\WPy64-31241\python-3.12.4.amd64\Lib\site-packages\xrt-1.6.0-py3.12.egg\xrt\backends\raycing\materials.py", line 1783, in get_amplitude_pytte tmaxCL = np.ones(NRAYS, dtype=ucl.cl_precisionF)*np.pi ^^^^^^^^^^^^^^^^^ AttributeError: 'XRT_CL' object has no attribute 'cl_precisionF'

kklmn commented 1 month ago

You need pyopencl for this example, there are warnings in red about it.

ihepzyguo commented 1 month ago

I have install the pyopencl, When I enter this in Spyder, it shows that it has already been installed.

[1] pip install pyopencl Requirement already satisfied: pyopencl in d:\winpython\wpy64-31241\python-3.12.4.amd64\lib\site-packages (2024.2.7) Requirement already satisfied: numpy in d:\winpython\wpy64-31241\python-3.12.4.amd64\lib\site-packages (from pyopencl) (1.26.4) Requirement already satisfied: platformdirs>=2.2.0 in d:\winpython\wpy64-31241\python-3.12.4.amd64\lib\site-packages (from pyopencl) (4.2.2) Requirement already satisfied: pytools>=2024.1.5 in d:\winpython\wpy64-31241\python-3.12.4.amd64\lib\site-packages (from pyopencl) (2024.1.8) Requirement already satisfied: siphash24>=1.6 in d:\winpython\wpy64-31241\python-3.12.4.amd64\lib\site-packages (from pytools>=2024.1.5->pyopencl) (1.6) Note: you may need to restart the kernel to use updated packages. DEPRECATION: Loading egg at d:\winpython\wpy64-31241\python-3.12.4.amd64\lib\site-packages\xrt-1.6.0-py3.12.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation. Discussion can be found at https://github.com/pypa/pip/issues/12330

------------------ 原始邮件 ------------------ 发件人: "kklmn/xrt" @.>; 发送时间: 2024年7月19日(星期五) 晚上6:02 @.>; @.**@.>; 主题: Re: [kklmn/xrt] Report an error when set useTT is true for using elastic deformation in crystal reflectivity (Issue #190)

You need pyopencl for this example, there are warnings in red about it.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

kklmn commented 1 month ago

You can see the problem with your pyopencl by

  1. running tests/raycing/info_opencl.py or
  2. by starting xrt/gui/xrtQookStart.py and looking at "Your system:" on the right and, if pyopencl is available, by listing "OpenCL Platforms and Devices" with the "GPU" tool button.
ihepzyguo commented 1 month ago
  1. runing info_opencl.py: runfile('D:/WinPython/WPy64-31241/xrt-master/tests/raycing/info_opencl.py', wdir='D:/WinPython/WPy64-31241/xrt-master/tests/raycing')

============================================================ OpenCL Platforms and Devices

Platform - Name:  Intel(R) OpenCL Graphics Platform - Vendor:  Intel(R) Corporation Platform - Version:  OpenCL 3.0  Platform - Extensions:  cl_khr_byte_addressable_store cl_khr_device_uuid cl_khr_fp16 cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics cl_khr_icd cl_khr_local_int32_base_atomics cl_khr_local_int32_extended_atomics cl_intel_command_queue_families cl_intel_subgroups cl_intel_required_subgroup_size cl_intel_subgroups_short cl_khr_spir cl_intel_accelerator cl_intel_driver_diagnostics cl_khr_priority_hints cl_khr_throttle_hints cl_khr_create_command_queue cl_intel_subgroups_char cl_intel_subgroups_long cl_khr_il_program cl_intel_mem_force_host_memory cl_khr_subgroup_extended_types cl_khr_subgroup_non_uniform_vote cl_khr_subgroup_ballot cl_khr_subgroup_non_uniform_arithmetic cl_khr_subgroup_shuffle cl_khr_subgroup_shuffle_relative cl_khr_subgroup_clustered_reduce cl_intel_device_attribute_query cl_khr_suggested_local_work_size cl_intel_split_work_group_barrier cl_intel_spirv_media_block_io cl_intel_spirv_subgroups cl_khr_spirv_no_integer_wrap_decoration cl_intel_unified_shared_memory cl_khr_mipmap_image cl_khr_mipmap_image_writes cl_ext_float_atomics cl_intel_planar_yuv cl_intel_packed_yuv cl_khr_int64_base_atomics cl_khr_int64_extended_atomics cl_khr_image2d_from_buffer cl_khr_depth_images cl_khr_3d_image_writes cl_intel_media_block_io cl_intel_subgroup_local_block_io cl_khr_integer_dot_product cl_khr_gl_sharing cl_khr_gl_depth_images cl_khr_gl_event cl_khr_gl_msaa_sharing cl_khr_d3d10_sharing cl_khr_d3d11_sharing cl_intel_d3d11_nv12_media_sharing cl_intel_sharing_format_query cl_khr_pci_bus_info cl_intel_simultaneous_sharing  Platform - Profile:  FULL_PROFILE     --------------------------------------------------------     Device - Name:  Intel(R) Iris(R) Xe Graphics     Device - Vendor:  Intel(R) Corporation     Device - Type:  ALL | GPU     Device - Max Clock Speed:  1500 Mhz     Device - Compute Units:  96     Device - Local Memory:  64 KB     Device - Constant Memory:  4194296 KB     Device - Global Memory: 13 GB     Device - FP:  0

<pyopencl.Context at 0x1bf8f4e3b80 on <pyopencl.Device 'Intel(R) Iris(R) Xe Graphics' on 'Intel(R) OpenCL Graphics' at 0x1bfffca2310>>

  1. test xrtqookstart.py : your system: Windows 11, Python 3.12.4 Qt 5.15.2, PyQt5 5.15.10 OpenGL 3.1.7 , but GLUT is not found pyopencl 2024.2.7 Sphinx 7.2.6 xrt 1.6.0 in D:\WinPython\WPy64-31241\python-3.12.4.amd64\Lib\site-packages\xrt-1.6.0-py3.12.egg, this is the latest version on PyPI

------------------ 原始邮件 ------------------ 发件人: "kklmn/xrt" @.>; 发送时间: 2024年7月19日(星期五) 晚上6:26 @.>; @.**@.>; 主题: Re: [kklmn/xrt] Report an error when set useTT is true for using elastic deformation in crystal reflectivity (Issue #190)

You can see the problem with your pyopencl by

running tests/raycing/info_opencl.py or

by starting xrt/gui/xrtQookStart.py and looking at "Your system:" on the right and, if pyopencl is available, by listing "OpenCL Platforms and Devices" with the "GPU" tool button.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

kklmn commented 1 month ago

Intel Graphics is not a serious device for calculations, it doesn't even support FP32, and in most cases we need FP64. For heavy calculations you need decent hardware.

ihepzyguo commented 1 month ago

The core problem was that opencl didn't recognize Intel CPU, so I referred to the URL(Solved: Re:OpenCL for CPU is installed, but OpenCL cannot find CPU - Intel Community) and installed Intel  One API toolkts, then it works.  The CPU can be found by Opencl now. 

D:\WinPython\WPy64-31241\xrt-master\examples\withRaycing\07_AnalyzerBent2D\01BD_SourceZCrystalThetaAlpha-copy.py:576: SyntaxWarning: invalid escape sequence '\d'   '\delta E = ${3:.3f} eV').format( OpenCL: bulding None ... OpenCL: found 1 CPU OpenCL: found none GPU OpenCL: found 1 other accelerator OpenCL for None: Autoselected device 0: Intel(R) FPGA Emulation Device precisionOpenCL = float32 D:\WinPython\WPy64-31241\python-3.12.4.amd64\Lib\site-packages\pyopencl__init__.py:519: CompilerWarning: From-source build succeeded, but resulted in non-empty logs: Build on <pyopencl.Device 'Intel(R) FPGA Emulation Device' on 'Intel(R) FPGA Emulation Platform for OpenCL(TM)' at 0x233983db780> succeeded.

------------------ 原始邮件 ------------------ 发件人: "kklmn/xrt" @.>; 发送时间: 2024年7月19日(星期五) 晚上6:46 @.>; @.**@.>; 主题: Re: [kklmn/xrt] Report an error when set useTT is true for using elastic deformation in crystal reflectivity (Issue #190)

Intel Graphics is not a serious device for calculations, it doesn't even support FP32, and in most cases we need FP64. For heavy calculations you need decent hardware.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>