astamm / fdacluster

Clustering functional data with amplitude and phase separation.
https://astamm.github.io/fdacluster/
GNU General Public License v3.0
5 stars 0 forks source link

Undefined behaviour sanitiser issues #2

Closed astamm closed 2 years ago

astamm commented 2 years ago

Prof. Ripley detected these issues: https://cran.r-project.org/web/checks/check_results_fdacluster.html.

I am investigating any coding error in fdacluster but I wonder whether it might be an issues in submatrix views in armadillo. Do you know of such issues @eddelbuettel ?

eddelbuettel commented 2 years ago

No I do not. That said, as @conradsnicta updates at a cadence faster than CRAN's desired monthly (the do check for 'no more than six uploads in six months' so I space it out) we are one bug fix behind and/or it could be a new issue.

So ideally could you please

I can help with some of the Docker mechanics if you need it.

astamm commented 2 years ago

I am happy to implement those steps although, as you might have hinted by offering your help, I am not that familiar with Docker mechanics. I am happy to accept your help here. I will still read through Winston repo, thanks.

eddelbuettel commented 2 years ago

Can you get access to a Linux machine that has Docker enabled? I understand this foreign territory I never visit called 'macOS' also does but I can't help with specific there.

Docker in general will use something like the following to make your current working directory (ie your repo) available to it:

 docker run --rm -ti -v ${PWD}:/mywork -w /mywork --security-opt seccomp=unconfined wch1/r-debug bash

and then (important !!) use the RDsan or RDcsan versions of R instrumented for it. You then need to install all your depenencies using that instance. As I recall, the container is 'fat' and has a few commonly used things already (such as Rcpp) but you likely need RcppArmadillo, nloptr, ... so it is a good idea to keep the Docker session up in a terminal while you iterate over the code in the directory you mounted. That way you have toolchain to edit outside yet Docker giving you (UB)SAN equipped R.

astamm commented 2 years ago

Thanks Dirk. I do not have access to a Linux machine. I am installing Docker and my Mac and I hope that between Winston's README and your helpful comments, I will be able to get it running.

eddelbuettel commented 2 years ago

Yes. There are approximately 1e4 tutorials for Docker use on macOS. I understand there is a GUI. I only ever drive from the cmdline.

Also, on the topic, a classic from 1995 for you here:
image

astamm commented 2 years ago

That's a good one! I have indeed downloaded the GUI. And I ran docker run --rm -ti --security-opt seccomp=unconfined wch1/r-debug in my repo from terminal as per Winston README Quickstart instruction. It should then pop up in the GUI, so they say in there. But it is taking quite some time downloading lots of stuff apparently. Should take some time.

eddelbuettel commented 2 years ago

Docker is much 'skinnier' and faster on Linux and it is Linux-on-Linux there. You get the pleasure of taking it all in via a VM slipped in between Docker and your OS.

The PR I mentioned is now up at https://github.com/RcppCore/RcppArmadillo/pull/363. Those were commits I had made here once 10.8.2 came out but not pushed til the (length, slow machine) reverse-depends checks were done. Congrats, btw, on another package at CRAN :) I saw this via CRANberries (via RSS and Twitter).

PR should be in master 'shortly'.

astamm commented 2 years ago

Okay, the Docker image is mounted. I can see my repo in there but RDsan fails because of the emulation... I will have to dig into the online tutorials to understand how to move forward.

eddelbuettel commented 2 years ago

Ah, could be the VM gets in the way. RHub has a sanitizer build available but it may not replicate what BDR found. Worth a try.

astamm commented 2 years ago

Thanks for digging into it @conradsnicta. I was doing the same line of reasoning here. I will check whether the other runtime errors spotted by UBSAN are only corollaries of that one or if there are other issues in my code.

astamm commented 2 years ago

I usually use round brackets as per your recommandations in armadillo documentation indeed. That one slipped away.

astamm commented 2 years ago

Apparently, I did not fix all of them. I need to find a Linux machine to run the docker image to check these as BDR did.

astamm commented 2 years ago

I have access to a Linux computer with singularity but not docker. @eddelbuettel Do you know if that would work for running Winston's r-devel image? I tried r-hub's but their Debian machine which is used for compiling with sanitizers has trouble installing Rcpp and RcppArmadillo apparently. Gabor is looking into it.

eddelbuettel commented 2 years ago

Sorry, honestly no idea. I often hear from singularity users who proseculize on how much better yada yada yada. I mostly tune out by now as I use Docker which "works for me (TM)". I think it "should" work for you but then we said the same for macOS where it turned out the virtualization got in the way of ASAN/UBSAN.

I use that r-hub machine fairly regularly, and I think I only ever had issues with missing external libraries. There is something persistently "off" though (but in a benign way) -- I think each email I get from it says 'Error' but when you look at the log it is the inverse. Free service and all that. @gaborcsardi will likely help you; the bigger issue is that CRAN is not exactly as helpful as one would hope and that box is not a 100% replica of what BDR uses. Ah well.