Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unhandled exception when calling IMRdHdr #20

Open
bnorthan opened this issue May 22, 2024 · 6 comments
Open

Unhandled exception when calling IMRdHdr #20

bnorthan opened this issue May 22, 2024 · 6 comments

Comments

@bnorthan
Copy link

bnorthan commented May 22, 2024

Hi

I successfully built the code, but am having trouble running it.

First I am deviating a bit from the build instructions as I am not using Conda. Instead I just grabbed the dependencies (many of which I had on my machine anyway) and bullt with VS2019 compiler and am trying to run through visual studio code. (if it is a really bad idea to bypass the conda install let me know).

Anyway everything builds fine but when I run I have a problem when it hits the below code from mrc.h

 int ixyz[3];
 int mxyz[3];
 int pixeltype;
 float min;
 float max;
 float mean;
 IMRdHdr(istream_no, ixyz, mxyz, &pixeltype, &min, &max, &mean);
 IMGetHdr(istream_no, &header);

I don't totally understand the logic. Is it writing something to the file then reading it back? An exception occurs in stdio.h. I can't see what is happening in IMRdHdr as that is provided as a prebuilt library however the line that is failing in stdio.h is below.

 #else
    {
        return __stdio_common_vfprintf(_CRT_INTERNAL_LOCAL_PRINTF_OPTIONS, _Stream, _Format, _Locale, _ArgList);
    }

I figure maybe there is a conflict between versions of the c runtime that libimlib and libive were linked to and VS 2019, but so far haven't able to figure out a workaround.

Any ideas? I also saw there are some Visual Studio project files in the repo. Should I try those instead of fooling around with VSCode?

@tlambert03
Copy link
Member

yeah, there's a lot to unpack here if you're going to be building on your own. I would first need to know what you mean by "when I run". when you run what? a specific file? just getting the help? The code you're pointing at (IMRdHdr and IMGetHdr) is simply reading the header of an mrc file. Whether you hit that chunk of code at runtime should depend on what command you use, and what file you use. If you don't build with mrc support then I would expect you to run into issues there. This gets in the weeds relatively quickly. I'll ping you offline for in depth discussion, but I would start at a higher level (probably the python wrapper) first and then dig back down here if necessary

@linshaova
Copy link
Collaborator

Hi Brian,

I could also help. The code snippet you cited is just the peculiar way of how the UCSF IVE library reads the header info of an MRC file: first you "read" the header and then you "get" the header (I agree it's a bit funky but it does work). I agree with Talley that you'll need to provide more details of the errors. I haven't done building the cudaSirecon code on Windows for years, but one way I can help is trying that on my Windows and see if I can reproduce the errors you saw.
-lin

@tlambert03
Copy link
Member

thanks @linshaova! We've also been chatting offline a bit about this. @bnorthan has some theories as to why it's not working. thanks for the offer! I can also try to build locally again if need be. @bnorthan keep us updated

@tlambert03
Copy link
Member

@bnorthan, you might be interested in trying #24, which removes the IVE dependency. should be much easier to compile now

@bnorthan
Copy link
Author

bnorthan commented Aug 2, 2024

Thanks. This is very timely as I've recently been testing the c version simrecon vs cudasirecon and found a few differences, so being able to compile and step through the code will be helpful.

@bnorthan
Copy link
Author

@tlambert03

I just tested this branch on Linux with this data, otf, and config file

Both the main branch and the new_mrc branch compiled. The main branch ran fine, but the new_mrc branch crashed and reported unrealistic sizes for the OTF. Not sure if I did anything wrong on my end. In both cases used the same config and ran the code via run.sh.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants