lattice / quda

QUDA is a library for performing calculations in lattice QCD on GPUs.
https://lattice.github.io/quda
Other
289 stars 97 forks source link

blas_magma.cpp does not compile #335

Closed maddyscientist closed 9 years ago

maddyscientist commented 9 years ago

On the develop branch after the recent merge of the mixed-precision eigCG support (62868e52cd701ba86b9c27684a0ddbc77fcede16). There are two issues that I can see:

There are dozens of errors, here's a sample :)

blas_magma.cpp:523:46: error: use of undeclared identifier 'magmaDoubleComplex'
    cudaHostRegister(pQR, ldqr*nrefls*sizeof(magmaDoubleComplex), cudaHostRegisterMapped);
                                             ^
blas_magma.cpp:1047:17: error: use of undeclared identifier 'creal'
  lwork = (int)(creal(qwork));

@alexstrel Please fix this as soon as possible inserting the appropriate macros to prevent compilation and replace the C99 complex numbers with C++ complex numbers (use quda::complex or std::complex).

maddyscientist commented 9 years ago

Quoting from here: http://stackoverflow.com/questions/10540228/c-complex-numbers-in-c

A C++ compiler could choose to support the _Complex keyword as an extension (and a few do), but that isn't portable. If you want to have a portable C++ solution, you need to use the C++ std::complex templates, unfortunately.

The good news is that C++ std::complex numbers are guaranteed to be compatible with C99 complex numbers (in the sense that a pointer to one can always be converted to a pointer to the other, and the right thing will happen), which means that if you need to interoperate with a C library that expects C99 complex values, you shouldn't have any trouble.

So you should be able to work with C++ complex numbers on the QUDA side of things, and it should work ok.

alexstrel commented 9 years ago

ok, thanks.

alexstrel commented 9 years ago

Compilation errors fixed, I cleaned magma interface because it contained stuff required by GMRESDR solver only (I missed this point completly). There are now runtime errors, namely ERROR: CopyGenericColorSpinor has not been built for Nspin=4 fields this i did not observe with yesterday's feature branch.. Comments?

maddyscientist commented 9 years ago

Do you have a branch I can test this on to work out the problem?

maddyscientist commented 9 years ago

Ok, I see the problem. Can you swap this on line 413 of copy_color_spinor.cu

#if defined(GPU_STAGGERED_DIRAC)

for this

#if defined(GPU_WILSON_DIRAC) || defined(GPU_DOMAIN_WALL_DIRAC)
alexstrel commented 9 years ago

sure , this was the problem, thanks!

alexstrel commented 9 years ago

hmm, incremental stage was successful, but deflted CG collapsed, still need some time to resolve this issue before the pull request, CG: 0 iterations, <r,r> = 4.611374e+06, |r|/|b| = 9.999999e-01, heavy-quark residual = 1.730952e+00 CG: 1 iterations, <r,r> = 1.840267e+06, |r|/|b| = 6.317208e-01, heavy-quark residual = 6.319742e-01 CG: 2 iterations, <r,r> = 7.712731e+05, |r|/|b| = 4.089676e-01, heavy-quark residual = 6.319742e-01 CG: 3 iterations, <r,r> = 3.902850e+05, |r|/|b| = 2.909214e-01, heavy-quark residual = 6.319742e-01 CG: 4 iterations, <r,r> = 1.940245e+05, |r|/|b| = 2.051224e-01, heavy-quark residual = 6.319742e-01 CG: 5 iterations, <r,r> = 9.574212e+04, |r|/|b| = 1.440908e-01, heavy-quark residual = 6.319742e-01 CG: 6 iterations, <r,r> = 4.828334e+04, |r|/|b| = 1.023254e-01, heavy-quark residual = 6.319742e-01 CG: 7 iterations, <r,r> = 2.421310e+04, |r|/|b| = 7.246195e-02, heavy-quark residual = 6.319742e-01 CG: 8 iterations, <r,r> = 1.212623e+04, |r|/|b| = 5.127997e-02, heavy-quark residual = 6.319742e-01 CG: 9 iterations, <r,r> = 6.092978e+03, |r|/|b| = 3.634960e-02, heavy-quark residual = 6.319742e-01 CG: 10 iterations, <r,r> = 3.063799e+03, |r|/|b| = 2.577597e-02, heavy-quark residual = 6.319742e-01 CG: 11 iterations, <r,r> = 1.539253e+03, |r|/|b| = 1.827006e-02, heavy-quark residual = 9.515757e-03 CG: 12 iterations, <r,r> = 7.756649e+02, |r|/|b| = 1.296946e-02, heavy-quark residual = 9.515757e-03 WARNING: CG: new reliable residual norm 4.472954e+03 is greater than previous reliable residual norm 2.147411e+03 (total #inc 1) WARNING: CG: Restarting without reliable updates for heavy-quark residual CG: 13 iterations, <r,r> = 2.000731e+07, |r|/|b| = 2.082952e+00, heavy-quark residual = 1.041821e+00 CG: 14 iterations, <r,r> = 2.973748e+07, |r|/|b| = 2.539434e+00, heavy-quark residual = 1.041821e+00 CG: 15 iterations, <r,r> = 1.263694e+07, |r|/|b| = 1.655411e+00, heavy-quark residual = 1.041821e+00 CG: 16 iterations, <r,r> = 6.113315e+06, |r|/|b| = 1.151392e+00, heavy-quark residual = 1.041821e+00 CG: 17 iterations, <r,r> = 2.975311e+06, |r|/|b| = 8.032504e-01, heavy-quark residual = 1.041821e+00 CG: 18 iterations, <r,r> = 1.513198e+06, |r|/|b| = 5.728391e-01, heavy-quark residual = 1.041821e+00 CG: 19 iterations, <r,r> = 7.568782e+05, |r|/|b| = 4.051332e-01, heavy-quark residual = 1.041821e+00 CG: 20 iterations, <r,r> = 3.787794e+05, |r|/|b| = 2.866012e-01, heavy-quark residual = 1.041821e+00 CG: 21 iterations, <r,r> = 1.921011e+05, |r|/|b| = 2.041031e-01, heavy-quark residual = 2.492663e-02 CG: 22 iterations, <r,r> = 9.647581e+04, |r|/|b| = 1.446419e-01, heavy-quark residual = 2.492663e-02 CG: 23 iterations, <r,r> = 4.843184e+04, |r|/|b| = 1.024826e-01, heavy-quark residual = 2.492663e-02 CG: 24 iterations, <r,r> = 2.439292e+04, |r|/|b| = 7.273051e-02, heavy-quark residual = 2.492663e-02 CG: 25 iterations, <r,r> = 1.228554e+04, |r|/|b| = 5.161571e-02, heavy-quark residual = 2.492663e-02 CG: 26 iterations, <r,r> = 6.184767e+03, |r|/|b| = 3.662237e-02, heavy-quark residual = 2.492663e-02 CG: 27 iterations, <r,r> = 3.118669e+03, |r|/|b| = 2.600576e-02, heavy-quark residual = 2.492663e-02 CG: 28 iterations, <r,r> = 1.573619e+03, |r|/|b| = 1.847288e-02, heavy-quark residual = 2.492663e-02 CG: 29 iterations, <r,r> = 7.930396e+02, |r|/|b| = 1.311391e-02, heavy-quark residual = 2.492663e-02 CG: 30 iterations, <r,r> = 4.000733e+02, |r|/|b| = 9.314394e-03, heavy-quark residual = 2.492663e-02 CG: 31 iterations, <r,r> = 2.020004e+02, |r|/|b| = 6.618520e-03, heavy-quark residual = 7.989245e-04 WARNING: CG: new reliable residual norm 2.784615e+04 is greater than previous reliable residual norm 4.472954e+03 (total #inc 2) WARNING: CG: Restarting without reliable updates for heavy-quark residual WARNING: CG: new reliable HQ residual norm 1.471889e+00 is greater than previous reliable residual norm 1.041821e+00 CG: 32 iterations, <r,r> = 7.754078e+08, |r|/|b| = 1.296731e+01, heavy-quark residual = 1.471889e+00 CG: 33 iterations, <r,r> = 1.657868e+09, |r|/|b| = 1.896093e+01, heavy-quark residual = 1.471889e+00 CG: 34 iterations, <r,r> = 6.752485e+08, |r|/|b| = 1.210087e+01, heavy-quark residual = 1.471889e+00

mathiaswagner commented 9 years ago

I would prefer to have a pull request now which fixes the compilation. Having a develop branch that does not compile is highly undesirable. Fixing that is the highest priority.

We can keep the branch alive after that first pull and you can fix the other issues. Once these are fixed we can do a second pull.

alexstrel commented 9 years ago

since the observed run time problem is unrelated to the original compilation issue, I suggest to close this item.

mathiaswagner commented 9 years ago

I would like to keep that open until we confirmed that compilation works now and #336 is merged in develop.

nmrcardoso commented 9 years ago

tested here and blas_magma.cpp compiles without errors (using option BUILD_MAGMA = no).

On Fri, Jul 31, 2015 at 9:47 AM, Mathias Wagner notifications@github.com wrote:

Reopened #335 https://github.com/lattice/quda/issues/335.

— Reply to this email directly or view it on GitHub https://github.com/lattice/quda/issues/335#event-370574737.

mathiaswagner commented 9 years ago

Thanks, @nmrcardoso. I just would like to wait if it is also is fine with @mikeaclark and her clang compilation.

maddyscientist commented 9 years ago

Confirmed, the bug is fixed.

alexstrel commented 9 years ago

So, we can now close the issue?

mathiaswagner commented 9 years ago

closed with #336