PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

CUDA-x86.

how to call an executable file and give the variables

 
Post new topic   Reply to topic    PGI User Forum Forum Index -> Programming and Compiling
View previous topic :: View next topic  
Author Message
Chia-WenChan52986



Joined: 25 Feb 2014
Posts: 11

PostPosted: Tue Apr 29, 2014 7:58 pm    Post subject: how to call an executable file and give the variables Reply with quote

I would like to call an executable file and give it variables in my fortran code. for example:

Code:
function obj(ii)
use omp_lib
use  ifport
implicit none
integer,intent(in)::ii
integer::     thron
real::obj
thron=omp_get_thread_num()
obj=RUNQQ('C:\pgi\matlab_omp_cuda\test.exe','')
return
end function  obj


In this code, "thron" is the thread no. which is a variable in another executable file.
Back to top
View user's profile
cparrott



Joined: 02 May 2011
Posts: 141

PostPosted: Wed Apr 30, 2014 12:40 pm    Post subject: Reply with quote

Hi Chia,

Could you do something like this?

Code:

function obj(ii)
use omp_lib
use  ifport
implicit none
integer,intent(in)::ii
integer::     thron
real::obj
character(len=80) :: cmdline
thron=omp_get_thread_num()
write (cmdline, '(i1)') thron
obj=RUNQQ('C:\pgi\matlab_omp_cuda\test.exe', trim(cmdline))
return
end function  obj


This modification would basically convert thron to a string, store it in the cmdline variable, then pass the cmdline variable as a parameter to the test.exe application.

However, this assumes that the test.exe application has been coded in such a way as to expect this parameter upon being called, and handle it correctly.

Hope this helps,

+chris
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    PGI User Forum Forum Index -> Programming and Compiling All times are GMT - 7 Hours
Page 1 of 1

 
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