"Thomas Koenig" wrote in message
news:tkqben$38a5n$1...@newsreader4.netcologne.de...
> James Van Buskirk <
not_...@comcast.net> schrieb:
> > OK, I made some progress in my hobby project and now it
> > displays a graph of its results. I put a READ(*,'(a)') statement
> > at the end so my graphs wouldn't go away when the
> > program terminates.
> > After considerable effort I found out how to write a *.ppm
> > file and how to get gimp.exe to convert all of my *.ppm
> > files (which most software can't read) to *.png.
> You can also use the pngtopng command from netpbm, which
> is a bit more lightweight than gimp :-)
Well, I installed gimp for a previous project and its licensing
arrangements seemed satisfactory. It's a bitch to use it in
batch mode, though. What would have been really cool
would have been a printer driver that had the option to
print to file with *.png being one of the accessible formats.
Then I could have rendered to the file like I have rendered
to printer previously. However, Windows doesn't come with
such goodies: Microsoft XPS Document Writer seems to be
able to embed a PNG in a *.oxps file, but I couldn't figure
out how to extract it from there. There are drivers out
there on the web that can print to *.png, but using them
would mean the my program wouldn't be self-contained.
> > Then I wrote a *.bat file that permits me to run a bunch
> > of scenarios. Since I didn't want to have to change focus
> > to the CMD.exe window and hit <ENTER> for every run
> > of the program, I had it detect when it was running in batch
> > mode and skip the READ(*,'(a)') statement because the
> > graphs would be available in *.png form anyway.
> > However, this caused a problem because the last and of
> > course most important *.ppm doesn't complete writing
> > before its thread closes,
> Do you do different threads in a main program? If
> so, how? OpenMP? Coarrays? pthreads? Windows
> threads?
> Or did you just mean program?
No, Windows threads with _beginthreadex() and the
whole 9 yards. I tried putting a WaitForSingleObject
call before program termination, but it had no effect.
Seemingly the thread (and my *.ppm file) were already
long gone by that time.
> >so I don't get that *.ppm file.
> > I tried putting a FLUSH(iunit) statement before the
> > CLOSE(iunit) statement, but still no joy. How am I
> > supposed to tell the thread to wait for the *.ppm file
> > to get properly written and saved before returning?
> This is very hard to answer without knowing exactly what
> you did, what system (I presume Windows), and what
> thread model and what compiler you used.
D:\gfortran\james>gfortran -v
Using built-in specs.
COLLECT_GCC=gfortran
COLLECT_LTO_WRAPPER=C:/Program\
Files/mingw64/bin/../libexec/gcc/x86_64-w64-ming
w32/12.2.0/lto-wrapper.exe
Target: x86_64-w64-mingw32
Configured with:
../../../src/gcc-12.2.0/configure --host=x86_64-w64-mingw32 --b
uild=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --prefix=/mingw64 --with-sys
root=/c/buildroot/x86_64-1220-win32-seh-rt_v10-rev1/mingw64 --enable-host-shared
--disable-multilib --enable-languages=c,c++,fortran,lto --enable-libstdcxx-time
=yes --enable-threads=win32 --enable-libgomp --enable-libatomic --enable-lto
--e
nable-graphite --enable-checking=release --enable-fully-dynamic-string --enable-
version-specific-runtime-libs --enable-libstdcxx-filesystem-ts=yes --disable-lib
stdcxx-pch --disable-libstdcxx-debug --enable-bootstrap --disable-rpath --disabl
e-win32-registry --disable-nls --disable-werror --disable-symvers --with-gnu-as
--with-gnu-ld --with-arch=nocona --with-tune=core2 --with-libiconv --with-system
-zlib --with-gmp=/c/buildroot/prerequisites/x86_64-w64-mingw32-static --with-mpf
r=/c/buildroot/prerequisites/x86_64-w64-mingw32-static --with-mpc=/c/buildroot/p
rerequisites/x86_64-w64-mingw32-static --with-isl=/c/buildroot/prerequisites/x86
_64-w64-mingw32-static --with-pkgversion='x86_64-win32-seh-rev1, Built by
MinGW-
W64 project' --with-bugurl=
https://sourceforge.net/projects/mingw-w64
CFLAGS='-O
2 -pipe -fno-ident -I/c/buildroot/x86_64-1220-win32-seh-rt_v10-rev1/mingw64/opt/
include -I/c/buildroot/prerequisites/x86_64-zlib-static/include -I/c/buildroot/p
rerequisites/x86_64-w64-mingw32-static/include'
CXXFLAGS='-O2 -pipe -fno-ident -
I/c/buildroot/x86_64-1220-win32-seh-rt_v10-rev1/mingw64/opt/include -I/c/buildro
ot/prerequisites/x86_64-zlib-static/include -I/c/buildroot/prerequisites/x86_64-
w64-mingw32-static/include'
CPPFLAGS=' -I/c/buildroot/x86_64-1220-win32-seh-rt_v
10-rev1/mingw64/opt/include -I/c/buildroot/prerequisites/x86_64-zlib-static/incl
ude -I/c/buildroot/prerequisites/x86_64-w64-mingw32-static/include'
LDFLAGS='-pi
pe -fno-ident -L/c/buildroot/x86_64-1220-win32-seh-rt_v10-rev1/mingw64/opt/lib
-
L/c/buildroot/prerequisites/x86_64-zlib-static/lib -L/c/buildroot/prerequisites/
x86_64-w64-mingw32-static/lib '
LD_FOR_TARGET=/c/buildroot/x86_64-1220-win32-seh
-rt_v10-rev1/mingw64/bin/ld.exe --with-boot-ldflags=' -Wl,--disable-dynamicbase
-static-libstdc++ -static-libgcc'
Thread model: win32
Supported LTO compression algorithms: zlib
gcc version 12.2.0 (x86_64-win32-seh-rev1, Built by MinGW-W64 project)
As you can see, the compiler is using win32 threads rather than posix. I
had
difficulties early on so I downloaded this compiler although I am not sure
if
it is necessary to use the win32 threads gfortran compiler if you are making
threads via the Win32 API.
The program is kinda long: win.f90=33 kB, gl.f90=41 kB, xygraph.f90 = 58 kB
and even my calculational engine is 47 kB. It definitely needs Windows to
work and the ifort-compiled version just hangs without any output.
Thus, it wouldn't do much good to post the code because nobody would
have the time, energy, and ability to investigate it.