Forum Jump

Select Group :
Select Forum :
Sorted By :
Sort Order :
From The :
 
Thread Tools  Search this thread 
jiang_2009
Total Points:
120
Status Points:
70
Green Belt
July 7, 2009 10:38 AM PDT
What should I do in multithreading if I change from x32 to x64 in VSF
hi
What should I do in multithreading if I change from x32 to x64 in Visual studio Fortran. I've tried a simple multithread test program under win32 platform and it runs well. However, it cannot pass the build process if I change the configuration to X64 platform. I will appreciate if anybody could give some help, thanks

here is my test code:

use IFMT
external threadfunc
PARAMETER(mTHREAD=2)
common /thread/A(2,10000)

integer(4) para(mThread)
integer hthread(mthread),idthread(mthread),hticketmutex
logical(4) waitall
integer(4) nresult,nwaitresult,nticket
common /ticket/nticket
common/mutex/hticketmutex

NTICKET=1

HTICKETMUTEX=CREATEMUTEX(0,.FALSE.,0)
WAITALL=.TRUE.
DO I=1,mTHREAD
para(i)=i
HTHREAD(I)=CREATETHREAD(0,0,THREADFUNC,loc(para(i)),0,IDTHREAD(I))
END DO
NWAITRESULT=WAITFORMULTIPLEOBJECTS(mTHREAD,HTHREAD(1),WAITALL,
&                   WAIT_INFINITE)

LOU=CLOSEHANDLE(hTicketMutex)

DO IJ=1,mTHREAD
LOU=CLOSEHANDLE(HTHREAD(IJ))
IF(LOU.EQ.0) THEN
PRINT *,'FAIL TO CLOSE HANDLES HTHREAD'
STOP
END IF
END DO
DO I=1,4
WRITE(*,*) A(1,I),A(2,I)
END DO
PAUSE
STOP
END



integer(4) function threadfunc(arg)
use IFMT
PARAMETER(mTHREAD=2)

common /thread/A(2,10000)

integer(4) arg
integer hticketmutex
logical(4) waitall
integer(4) nresult,nwaitresult,nticket
common /ticket/nticket
common/mutex/hticketmutex

nwaitresult=waitforsingleobject(hticketmutex,WAIT_INFINITE)


K1=NTICKET

nticket=nticket+1

DO I=1,10000
A(K1,I)=I*K1
END DO

threadfunc = 0
end function      

Error    1     error #6284: There is no matching specific function for this generic function reference.   [CREATEMUTEX]    C:\jiang\Multithread tests\mt\mtest.FOR    16   
Error    2     error #6284: There is no matching specific function for this generic function reference.   [CREATETHREAD]    C:\jiang\Multithread tests\mt\mtest.FOR    20   

these codes work well under 32bit configurartion. Does it mean I need to use some different functions (such as  CREATEMUTEX, CREATETHREAD) or change the configuration in project properties under X64 platform?
thanks again


jimdempseyatthecove
Total Points:
34,847
Status Points:
34,847
Black Belt
July 7, 2009 2:56 PM PDT
Rate
 
#1

Please repost this in the Fortran for Windows forum.

Also, try changing the types for your handles to HANDLE as opposed to integer(4)

Jim Dempsey




Intel Software Network Forums Statistics

8286 users have contributed to 31232 threads and 99107 posts to date.
In the past 24 hours, we have 7 new thread(s) 27 new posts(s), and 36 new user(s).

In the past 3 days, the most popular thread for everyone has been comparison cilk++, openmp, pthreads first results The most posts were made to comparison cilk++, openmp, pthreads first results The post with the most views is Very amusing...  Escalated as

Please welcome our newest member titanius.anglesmith