PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

Free OpenACC Webinar

VS2010 and PGI Fortran mixed?
Goto page 1, 2  Next
 
Post new topic   Reply to topic    PGI User Forum Forum Index -> Debugging and Profiling
View previous topic :: View next topic  
Author Message
Swiftkill



Joined: 25 Dec 2012
Posts: 5

PostPosted: Wed Jul 31, 2013 3:30 am    Post subject: VS2010 and PGI Fortran mixed? Reply with quote

Is it possible to debug fortran code in dll if calling program is written in Visual C++?

I've tried do this: set main program as startup executable in dll's project settings, then run debug instance.. to "freezes" for dozen seconds , then OS messages "pgdebug.exe has been stopped" (I translate from my language)

I didn't found anything relevant to this so far.

host OS: Windows 7 x64 with service packs
PGI Fortran 12.10 for VS2010
java 1.7.21 x64

iwhen I open PGI shell link and type pgdbg I ger error that required component isn't found: jpgdbg.jar

edit:
apparently on none of machines we have 12.10 installed on no jpgdbg.jar present.. provided what I scaped from other forum post it should be in installation directory - at least for linux.. but installer never adds it
Back to top
View user's profile
mkcolg



Joined: 30 Jun 2004
Posts: 6208
Location: The Portland Group Inc.

PostPosted: Thu Aug 01, 2013 3:07 pm    Post subject: Reply with quote

Hi Swiftkill,

Quote:
Is it possible to debug fortran code in dll if calling program is written in Visual C++?

You can debug the DLL if you are using the PVF debug engine rather than the VC debugger. The debug engine choice is made by whatever the StartUp project is; so you’d set the PVF DLL project as the StartUp project in the Solution Explorer. Then, in that project’s Debugging | Command property, put the full path to the exe built by the VC project.

We do have an example project (Found at C:\Program Files (x86)\Microsoft Visual Studio 11.0\PGI Visual Fortran\Samples\dlls\pvf_dll) which is set-up this way if you need an example.

Quote:
when I open PGI shell link and type pgdbg I ger error that required component isn't found: jpgdbg.jar
PVF does not ship the stand-alone debugger hence why the component isn't found. You'll need to install the PGI Workstation to use the PGDBG GUI.

Though, you can still use the command line PGDBG by adding the "-text" flag on start-up.

Hope this helps,
Mat
Back to top
View user's profile
Swiftkill



Joined: 25 Dec 2012
Posts: 5

PostPosted: Tue Aug 06, 2013 3:02 am    Post subject: Tried that. Reply with quote

Ok, so issue with standalone utility is irrelevant to ours. Thank you for hint about flag

I testedthat solution.

First, pvf_dll's project didn't had path setup, but I supplied it - I guess, it was determined by fact that it requires _full_ path to .exe.

Second - it didn't work. Setting pvf_dll as StartUp project and running Debug session resulted in Visual Studio hanging.

Edit:
Apparently, debug for that project didn't worked at all, although program was compiled succefully. Even if I used pvf_calling_dll as StartUp. Next, I tried to copy project folder to other location, trying to check if issue is with folder permissions and way Win7 treats Program Files. Surprisingly, it failed to compile at all. Despite projects are identical, logs for pvf_dll are quite different and in relocated project it failed to generate .lib file and gave weird messages:

Succeful build
Code:

PVF Build Log
Begin rebuild: clean project
Deleting intermediate and output files for project 'pvf_dll', configuration 'Debug'

Compiling Project ...

sub1.f90

c:\program files (x86)\pgi\win32\12.10\bin\pgfortran.exe -Hx,123,8 -Hx,123,0x40000 -Hx,0,0x40000000 -Mx,0,0x40000000 -Hx,0,0x20000000 -g -Bdynamic -Mbackslash -Mfree -I"c:\program files (x86)\pgi\win32\12.10\include" -I"C:\Program Files\PGI\Microsoft Open Tools 10\include" -I"C:\Program Files\PGI\Microsoft Open Tools 10\PlatformSDK\include" -Minform=warn -module "Win32\Debug" -o "Win32\Debug\sub1.obj" -c "C:\Program Files (x86)\Microsoft Visual Studio 10.0\PGI Visual Fortran\Samples\dlls\pvf_dll\pvf_dll\sub1.f90"

Command exit code: 0


--------------------------------------------------------------------------------

Linking...

c:\program files (x86)\pgi\win32\12.10\bin\pgfortran.exe -Wl,/libpath:"c:\program files (x86)\pgi\win32\12.10\lib" -Wl,/libpath:"C:\Program Files\PGI\Microsoft Open Tools 10\lib" -Wl,/libpath:"C:\Program Files\PGI\Microsoft Open Tools 10\PlatformSDK\lib" -Wl,/libpath:"C:\Program Files (x86)\PGI\win32\12.10\lib" -Wl,/libpath:"C:\Program Files\PGI\win64\12.10\lib" -Yl,"C:\Program Files\PGI\Microsoft Open Tools 10\bin" -Mmakedll -g -Bdynamic -o "C:\Program Files (x86)\Microsoft Visual Studio 10.0\PGI Visual Fortran\Samples\dlls\pvf_dll\Win32\Debug\pvf_dll.dll" "Win32\Debug\sub1.obj"

Command exit code: 0

Command output: [ Creating library C:\Program Files (x86)\Microsoft Visual Studio 10.0\PGI Visual Fortran\Samples\dlls\pvf_dll\Win32\Debug\pvf_dll.lib and object C:\Program Files (x86)\Microsoft Visual Studio 10.0\PGI Visual Fortran\Samples\dlls\pvf_dll\Win32\Debug\pvf_dll.exp ]

pvf_dll build succeeded.



Failed build
Code:

PVF Build Log
Begin rebuild: clean project
Deleting intermediate and output files for project 'pvf_dll', configuration 'Debug'

Compiling Project ...

Linking...

c:\program files (x86)\pgi\win32\12.10\bin\pgfortran.exe -Wl,/libpath:"c:\program files (x86)\pgi\win32\12.10\lib" -Wl,/libpath:"C:\Program Files\PGI\Microsoft Open Tools 10\lib" -Wl,/libpath:"C:\Program Files\PGI\Microsoft Open Tools 10\PlatformSDK\lib" -Wl,/libpath:"C:\Program Files (x86)\PGI\win32\12.10\lib" -Wl,/libpath:"C:\Program Files\PGI\win64\12.10\lib" -Yl,"C:\Program Files\PGI\Microsoft Open Tools 10\bin" -Mmakedll -g -Bdynamic -o "D:\Programming\Fortran\pvf_dll\Win32\Debug\pvf_dll.dll" ""

Command exit code: 0

Command output: [LINK : warning LNK4001: no object files specified; libraries used LINK : warning LNK4068: /MACHINE not specified; defaulting to X86 ]

pvf_dll build succeeded.
Back to top
View user's profile
ams



Joined: 14 Jul 2004
Posts: 41

PostPosted: Tue Aug 06, 2013 10:15 am    Post subject: Reply with quote

Let's back up and tackle the first problem you encountered, that of debugging Fortran code in a DLL when it is called from a VC++ main program.

PVF ships with a sample project that demonstrates this scenario. It is located here:

C:\Program Files (x86)\Microsoft Visual Studio 10.0\PGI Visual Fortran\Samples\interlanguage\vcmain_calling_pvfdll

Using PVF 13.7 installed to VS 2010 Premium SP1 with VC++, I was able to build, run and debug this example. I used the Debug configuration and built both 32 and 64 bit platforms.

Is there a reason that you haven't upgraded to 13.7? The example should also work in 12.10 but since you've encountered difficulty, perhaps this is the first thing that we should try.

If you've been working directly in the Samples directory, then before you upgrade please delete:

C:\Program Files (x86)\Microsoft Visual Studio 10.0\PGI Visual Fortran\Samples

so that you get a clean set of examples when you install PVF 13.7.

Annemarie
Back to top
View user's profile
Swiftkill



Joined: 25 Dec 2012
Posts: 5

PostPosted: Wed Aug 07, 2013 2:05 am    Post subject: Reply with quote

Thank's that cleans doubts.

Have subscription, just corporate stupidness.
That would require to upgrade entire enterprise to 13th version (it's server lice license), for which I don't have allowance or plan yet.
System is highly guarded , heh.

I solved second problem, apparently PVF project (at least in samples) store direct paths to object files and moving project to new location doesn't work until certain changed made them. If its how they work with new projects then it's wrong from point of team cooperation - e.g. same project on different machines might be in different places..

Debugger works and doesn't work at random on x64 OS,depending which project I try, I can't figure out yet what causes that. I made install on clean, non-network enabled machine x32 OS and it worked perfectly.

If you recommend to upgrade, I'll try push it - I just need some reference to do - they are very conservative about it.
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    PGI User Forum Forum Index -> Debugging and Profiling All times are GMT - 7 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © phpBB Group