maccallumlab / meld

Modeling with limited data
http://meldmd.org
Other
54 stars 28 forks source link

Error: identifier "MAXFLOAT" is undefined #112

Closed ca-taylor closed 1 year ago

ca-taylor commented 2 years ago

I'm trying to help Arup Mondal here at UF with the latest MELD source from github "master". We are encountering the error below at runtime. I see references to MAXFLOAT in the master branch but not in the 0.5.0 tag so I'm a little confused about how we should proceed. Presumably, "master" is newer than 0.5.0 but I don't know why the references to MAXFLOAT are showing up again.

Is this intentional or a regression?

openmm.OpenMMException: Error launching CUDA compiler: 256 /scratch/local/14006357/openmmTempKernel0x45056d0_142218.cu(1312): error: identifier "MAXFLOAT" is undefined

/scratch/local/14006357/openmmTempKernel0x45056d0_142218.cu(1334): warning: type qualifier is meaningless on cast type

/scratch/local/14006357/openmmTempKernel0x45056d0_142218.cu(1398): error: identifier "MAXFLOAT" is undefined

/scratch/local/14006357/openmmTempKernel0x45056d0_142218.cu(1420): warning: type qualifier is meaningless on cast type

jlmaccal commented 2 years ago

I don't know why the references to MAXFLOAT are showing up again.

Could you clarify what you mean by this? Was there a previous issue that I'm forgetting about?

ca-taylor commented 2 years ago

No, I don't think you are forgetting anything. I just saw some commits that made it look like MAXFLOAT was being removed from the code but maybe I misinterpreted them. Nonethless, the master branch now has two references to MAXFLOAT which are breaking the code for us AFAICT.

[chasman@login4 meld]$ git checkout master Switched to branch 'master' [chasman@login4 meld]$ grep -rI MAXFLOAT . ./plugin/platforms/cuda/src/kernels/computeMeld.cu: energyScratch[i] = MAXFLOAT; ./plugin/platforms/cuda/src/kernels/computeMeld.cu: energyScratch[i] = MAXFLOAT;

jlmaccal commented 2 years ago

I'm confused about these errors, as we've been running this version of MELD for quite a while without issue.

What version of CUDA is this? I thought that MAXFLOAT was defined by the compiler.

It might be reasonable to just hardcode this to be 3.402823466e+38, which is the max IEEE 754 single-precision floating-point value.

ccccclw commented 2 years ago

We were using cuda/11.0, it works for me to change the MAXFLOAT to FLT_MAX defined in https://github.com/maccallumlab/meld/blob/master/plugin/platforms/cuda/src/kernels/computeMeld.cu

ca-taylor commented 2 years ago

Right. That would be the recommended change. I'd just rather see it happen "upstream". I also find myself wondering why it shows up in the "master" branch but not any of the tagged releases (0.5.0, for example).

Regardless, we'll make the change to FLT_MAX locally and see how it goes.

jlmaccal commented 2 years ago

@ccccclw can you confirm that you were also getting an error with MAXFLOAT? I had thought that MAXFLOAT was portable, but obviously this is not the case. I can switch it to FLT_MAX.

I also find myself wondering why it shows up in the "master" branch but not any of the tagged releases (0.5.0, for example).

This is simply because we have changed a lot between 0.5 and master. We're just waiting for a few things to stabilize before tagging the next release.

ccccclw commented 2 years ago

Yes, I also got the same error before.