hightower8083 / synchrad

Synchrotron Radiation calculator via openCL
GNU General Public License v3.0
18 stars 11 forks source link

Problem trying to run synchrad with tutorials #31

Open Dinghy666 opened 5 months ago

Dinghy666 commented 5 months ago

Hello @hightower8083 and all,

I have been studying Synchrad recently,Thank you for the code!

There was a problem when I was running the Betatron_Example in tutorials and I am not sure why. I ran it on my laptop without a GPU.

    "grid": [
        (1e-3*omega_ch_crit/omega_1m, omega_ch_crit/omega_1m),  
        (0, 2*K0/gamma_0),
        (0.0, 2 * np.pi),
        (512, 32, 32),
    ],  
}
calc = SynchRad(calc_input)
calc.calculate_spectrum( particleTracks=tracks,
                         #comp='cartesian_complex',
                         file_spectrum = './spect_incoh.h5',
                         timeStep=c*dt )
calc.calculate_spectrum( particleTracks=tracks,
                         comp='cartesian_complex',
                         file_spectrum = './spect_coh.h5',
                         timeStep=c*dt )

when I choose platform Intel(R) OpenCL Graphics the error message:

Choose platform:
[0] <pyopencl.Platform 'Intel(R) OpenCL Graphics' at 0x1df89a9c6d0>
Choice [0]:Intel(R) OpenCL Graphics
Set the environment variable PYOPENCL_CTX='Intel(R) OpenCL Graphics' to avoid being asked again.
Running on 1 devices
  ALL | GPU device: Intel(R) Iris(R) Xe Graphics
Platform: Intel(R) Corporation
Compiler: OpenCL C 1.2 
---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
Cell In[20], line 10
      1 calc_input = {
      2     "grid": [
      3         (1e-3*omega_ch_crit/omega_1m, omega_ch_crit/omega_1m),  
   (...)
      7     ],  
      8 }
---> 10 calc = SynchRad(calc_input)
     11 calc.calculate_spectrum( particleTracks=tracks,
     12                          #comp='cartesian_complex',
     13                          file_spectrum = './spect_incoh.h5',
     14                          timeStep=c*dt )
     16 calc.calculate_spectrum( particleTracks=tracks,
     17                          comp='cartesian_complex',
     18                          file_spectrum = './spect_coh.h5',
     19                          timeStep=c*dt )

File D:\anaconda\Lib\site-packages\synchrad\calc.py:95, in SynchRad.__init__(self, Args, file_spectrum)
     93     self._init_comm()
     94     self._init_data()
---> 95     self._compile_kernels()
     96 else:
     97     self._read_args(file_spectrum)

File D:\anaconda\Lib\site-packages\synchrad\calc.py:596, in SynchRad._compile_kernels(self)
    593     fname += "kernel_nearfield.cl"
    595 src = Template( filename=fname ).render(**agrs)
--> 596 self._mapper = cl.Program(self.ctx, src).build()

File D:\anaconda\Lib\site-packages\pyopencl\__init__.py:535, in Program.build(self, options, devices, cache_dir)
    531 else:
    532     # cached
    534     from pyopencl.cache import create_built_program_from_source_cached
--> 535     self._prg, was_cached = self._build_and_catch_errors(
    536             lambda: create_built_program_from_source_cached(
    537                 self._context, self._source, options_bytes, devices,
    538                 cache_dir=cache_dir, include_path=include_path),
    539             options_bytes=options_bytes, source=self._source)
    541     if was_cached:
    542         build_descr = "cache retrieval"

File D:\anaconda\Lib\site-packages\pyopencl\__init__.py:583, in Program._build_and_catch_errors(self, build_func, options_bytes, source)
    575     err = _cl.RuntimeError(
    576             _cl._ErrorRecord(
    577                 msg=msg,
    578                 code=code,
    579                 routine=routine))
    581 # Python 3.2 outputs the whole list of currently active exceptions
    582 # This serves to remove one (redundant) level from that nesting.
--> 583 raise err

RuntimeError: clBuildProgram failed: BUILD_PROGRAM_FAILURE - clBuildProgram failed: BUILD_PROGRAM_FAILURE - clBuildProgram failed: BUILD_PROGRAM_FAILURE

Build on <pyopencl.Device 'Intel(R) Iris(R) Xe Graphics' on 'Intel(R) OpenCL Graphics' at 0x1df8c15ba40>:

5:3:26: warning: unsupported OpenCL extension 'cl_khr_fp64' - ignoring
#pragma OPENCL EXTENSION cl_khr_fp64 : enable
                         ^
5:7:12: error: use of type 'double' requires cl_khr_fp64 extension to be enabled
  __global double *spectrum,
           ^
5:8:12: error: use of type 'double' requires cl_khr_fp64 extension to be enabled
  __global double *x,
           ^
5:9:12: error: use of type 'double' requires cl_khr_fp64 extension to be enabled
  __global double *y,
           ^
5:10:12: error: use of type 'double' requires cl_khr_fp64 extension to be enabled
  __global double *z,
           ^
5:11:12: error: use of type 'double' requires cl_khr_fp64 extension to be enabled
  __global double *ux,
           ^
5:12:12: error: use of type 'double' requires cl_khr_fp64 extension to be enabled
  __global double *uy,
           ^
5:13:12: error: use of type 'double' requires cl_khr_fp64 extension to be enabled
  __global double *uz,
           ^
5:14:12: error: use of type 'double' requires cl_khr_fp64 extension to be enabled
           double wp,
           ^
5:18:12: error: use of type 'double' requires cl_khr_fp64 extension to be enabled
  __global double *omega,
           ^
5:19:12: error: use of type 'double' requires cl_khr_fp64 extension to be enabled
  __global double *sinTheta,
           ^
5:20:12: error: use of type 'double' requires cl_khr_fp64 extension to be enabled
  __global double *cosTheta,
           ^
5:21:12: error: use of type 'double' requires cl_khr_fp64 extension to be enabled
  __global double *sinPhi,
           ^
5:22:12: error: use of type 'double' requires cl_khr_fp64 extension to be enabled
  __global double *cosPhi,
           ^
5:26:12: error: use of type 'double' requires cl_khr_fp64 extension to be enabled
           double dt,
           ^
5:39:5: error: use of type 'double' requires cl_khr_fp64 extension to be enabled
    double omegaLocal = omega[iOmega];
    ^
5:40:5: error: use of undeclared identifier 'double3'; did you mean 'double'?
    double3 nVec = (double3) { sinTheta[iTheta]*cosPhi[iPhi],
    ^~~~~~~
    double
5:40:5: error: use of type 'double' requires cl_khr_fp64 extension to be enabled
5:40:21: error: use of undeclared identifier 'double3'; did you mean 'double'?
    double3 nVec = (double3) { sinTheta[iTheta]*cosPhi[iPhi],
                    ^~~~~~~
                    double
5:40:29: error: expected ';' at end of declaration
    double3 nVec = (double3) { sinTheta[iTheta]*cosPhi[iPhi],
                            ^
                            ;
5:44:5: error: use of undeclared identifier 'double3'; did you mean 'double'?
    double3 xLocal, uLocal, uNextLocal, aLocal, amplitude;
    ^~~~~~~
    double
5:44:5: error: use of type 'double' requires cl_khr_fp64 extension to be enabled
5:45:5: error: use of type 'double' requires cl_khr_fp64 extension to be enabled
    double time, phase, dPhase, sinPhase, cosPhase, c1, c2, gammaInv;
    ^
5:47:5: error: use of type 'double' requires cl_khr_fp64 extension to be enabled
    double dtInv = (double)1. / dt;
    ^
5:47:28: warning: double precision constant requires cl_khr_fp64, casting to single precision
    double dtInv = (double)1. / dt;
                           ^
5:47:21: error: use of type 'double' requires cl_khr_fp64 extension to be enabled
    double dtInv = (double)1. / dt;
                    ^
5:48:5: error: use of type 'double' requires cl_khr_fp64 extension to be enabled
    double wpdt2 =  wp * dt * dt;
    ^
5:49:5: error: use of type 'double' requires cl_khr_fp64 extension to be enabled
    double phasePrev = (double) 0.;
    ^
5:49:33: warning: double precision constant requires cl_khr_fp64, casting to single precision
    double phasePrev = (double) 0.;
                                ^
5:49:25: error: use of type 'double' requires cl_khr_fp64 extension to be enabled
    double phasePrev = (double) 0.;
                        ^
5:50:5: error: use of undeclared identifier 'double3'; did you mean 'double'?
    double3 spectrLocalRe = (double3) {0., 0., 0.};
    ^~~~~~~
    double
5:50:5: error: use of type 'double' requires cl_khr_fp64 extension to be enabled
5:50:30: error: use of undeclared identifier 'double3'; did you mean 'double'?
    double3 spectrLocalRe = (double3) {0., 0., 0.};
                             ^~~~~~~
                             double
5:50:38: error: expected ';' at end of declaration
    double3 spectrLocalRe = (double3) {0., 0., 0.};
                                     ^
                                     ;
5:51:5: error: use of undeclared identifier 'double3'; did you mean 'double'?
    double3 spectrLocalIm = (double3) {0., 0., 0.};
    ^~~~~~~
    double
5:51:5: error: use of type 'double' requires cl_khr_fp64 extension to be enabled
5:51:30: error: use of undeclared identifier 'double3'; did you mean 'double'?
    double3 spectrLocalIm = (double3) {0., 0., 0.};
                             ^~~~~~~
                             double
5:51:38: error: expected ';' at end of declaration
    double3 spectrLocalIm = (double3) {0., 0., 0.};
                                     ^
                                     ;
5:65:17: error: use of type 'double' requires cl_khr_fp64 extension to be enabled
        time = (double)it * dt;
                ^
5:66:19: error: use of undeclared identifier 'double3'; did you mean 'double'?
        xLocal = (double3) {x[it], y[it], z[it]};
                  ^~~~~~~
                  double

(options: -I D:\anaconda\Lib\site-packages\pyopencl\cl)

Am I getting something wrong?

Thank you for your help!