Sunteți pe pagina 1din 8

uaLaSLage ls a powerful L1L Lool wlLh loL of lnbullL sLages/rouLlnes whlch can do mosL of Lhe

funcLlonallLles requlred for Lhose Lhlngs uaLaSLage LL cant`L do Lhere are parallel rouLlnes whlch
can be wrlLLen ln C++ 1hls prlmer can Leach you how you can creaLe a parallel rouLlne ln few
mlnuLes regardless of wheLher or noL you are a C/C++ programmer 8uL Lo wrlLe some real good
codes you mlghL have Lo learn some C++ programmlng SLarLlng C programmlng wlLh Llnux ls a good
llnk Lo sLarL wlLh 8efore we begln few polnLs Lo be noLed


arallel rouLlnes are C++ componenLs bullL and complled exLernal Lo uaLaSLage noLe Lhey musL be
complled as C++ componenLs noL C 1hls C++ program should be wlLhouL maln() and complled uslng
Lhe compller opLlon speclfled under toA1_CCMlLLC1tr whlch can be found under
AdmlnlsLraLor parameLer opLlon and creaLe an ob[ecL (*o) 1hls wlll creaLe runLlme llbrarles whlch
are complled code wlLhouL maln le non selfconLalned execuLable flle Comp||er and comp||er
opt|ons can be found |n uaLaSLage AdmlnlsLraLor roperLles LnvlronmenL arallel
Compller Lx compller g++ compller opLlons C flC WnodeprecaLed tc Complle command
synLax Compller compller opLlons fllename wlLh exLensLlon Lx g++ C flC WnodeprecaLed c
fllename wlLh exLensLlon Peres Lhe Lyplcal sequence of sLeps for creaLlng a uaLaSLage parallel
rouLlne

Create --> Compile --> Link --> Execute


% Create CreaLe a C++ program wlLh maln() 1esL lL and lf successful remove Lhe maln() %
Comp||e Complle uslng Lhe compller opLlon speclfled under toA1_CCMlLLC1tr
noLeCompller and compller opLlons can be found ln uaLaSLage AdmlnlsLraLor
roperLles LnvlronmenL arallel Compller and creaLe an ob[ecL (*o) flle and puL
Lhls ob[ecL flle onLo Lhls dlrecLory 3% L|nk Llnk Lhe above ob[ecL (*o) Lo a uaLaSLage arallel
rouLlne by maklng Lhe relevanL enLrles ln Ceneral Lab 8ouLlne name arallel 8ouLlne
name 1ype LxLernal luncLlon Cb[ecL 1ype Cb[ecL / Llbrary LxLernal subrouLlne name
luncLlon name speclfled lnslde your C++ program Llbrary aLh Speclfled ln 2) Complle
secLlon + ob[ecL (*o) flle name Also speclfy Lhe 8eLurn 1ype and lf you have any lnpuL
parameLers Lo be passed speclfy LhaL ln ArgumenLs Lab 4% Lxecute now your parallel rouLlne
wlll be avallable lnslde your [ob lnclude and complle your [ob and execuLe Step by step
Lxamp|e Creat|ng a shared ob[ect 1) Create a C++ program w|th ma|n(% CreaLe a LexL flle
wlLh cpp exLn (Lx C8!1LS1cpp ) Lx



#include <stdlib.h
#include <stdio.h

int main()
,
char JutStr;
JutStr="Hello World - Jbject Testing";
printf(JutStr);
return 0;
,


1esL Lhls program Copy your compller speclflcaLlon from uaLaSLage AdmlnlsLraLor roperLles
LnvlronmenL arallel Compller and complle Lhe creaLed C++ program SynLax g++
programcpp to program Lx g++ C8!1LS1cpp o C8!1LS1 8un/LxecuLe uslng Lhe below command
SynLax /program /C8!1LS1 CuLpuL Pello World Cb[ecL 1esLlng lf you geL above ouLpuL LhaL
means your program ls successfully execuLed 8ewrlLe Lhe program wlLhouL maln() Lx

#include <stdlib.h
#include <stdio.h

char JbjTestJne()
,
char JutStr;
JutStr="Hello World - Jbject Testing";
return JutStr;
,

2)Comp||e the program CeL compller and compller opLlons from uaLaSLage AdmlnlsLraLor
roperLles LnvlronmenL arallel Compller Lx compller g++ compller opLlons C flC
WnodeprecaLed tc Complle command synLax

ompiler : compiler options : ,filename with extenstion,


Lx g++ C flC WnodeprecaLed c fllename wlLh exLensLlon LxecuLe Lhe below command g++ C
flC WnodeprecaLed tc C8!1LS1cpp 1hls wlll make and ob[ecL flle wlLh o exLn Lx C8!1LS1o
Move Lhls ob[ecL flle Lo any of Lhe Llbrary aLh of your preference Lx
/daLasLage/AscenLlal/uaLaSLage/xLnglne/llb l usually puL ln llb dlrecLory ?ou can locaLe your
llb dlrecLory from Llbrary aLh (Lu_Ll88A8?_A1P) 3% L|nk Llnk Lhe above ob[ecL (*o) Lo a
uaLaSLage arallel rouLlne ln Lhe reposlLory palleL torlghL cllcktr and chose tonew parallel
rouLlnetr and make Lhese enLrles ln Lhe Ceneral Lab koutine Nome arallel 8ouLlne name Lx
C8!LC11LS1 1ype LxLernal luncLlon Object 1ype Cb[ecL xterno/ subroutine nome luncLlon
name speclfled lnslde your C++ program Lx Cb[1esLCne (8emember? 1hls ls Lhe funcLlon name we
replaced for maln() le char * Cb[1esLCne() ) Librory Poth Speclfled ln Complle secLlon + ob[ecL (*o)
flle name Lx /daLasLage/AscenLlal/uaLaSLage/xLnglne/llb/C8!1LS1o keturn 1ype char* noLeAs
we dont`L have any lnpuL parameLers Lo be passed we are noL maklng any enLrles ln ArgumenLs
Lab now save and close Lhe wlndow 4) Lxecute CreaLe a LesL [ob and call Lhls parallel rouLlne lnslde
your [ob Lx 8ow CeneraLor 1ransformer SequenLlal llle ln Lhe Lransformer call Lhls rouLlne ln
your ouLpuL column derlvaLlon Complle and run Lhe [ob !oshy Ceorge


Pl !oshy

l have lssues ln runnlng Lhe sLeps
1) CreaLe a C++ program wlLh maln()
CreaLe a LexL flle wlLh cpp exLn (Lx C8!1LS1cpp )

Lx

#lnclude
#lnclude

lnL maln()

char* CuLSLr
CuLSLrPello World Cb[ecL 1esLlng
prlnLf(CuLSLr)
reLurn 0


1esL Lhls program
Copy your compller speclflcaLlon from
uaLaSLage AdmlnlsLraLor roperLles LnvlronmenL arallel Compller
and complle Lhe creaLed C++ program
SynLax g++ programcpp to program
Lx g++ C8!1LS1cpp o C8!1LS1

When l compleLe Lhls sLep Lhen Lry runnlng Lhe code uslng /C8!1LS1 Lhen lL says ksh /C8!1LS1
0403006 LxecuLe permlsslon denled
When l chmod 733 Lhen l geL Lhls error exec() 0309036 CannoL load program /C8!1LS1 because of
Lhe followlng errors




0309108 1he loader secLlon does noL exlsL could you please leL me know why where am l golng
wrong

1hanks
uevl

Pl !oshy Ceorge
1hank you very much for provldlng Lhe lnfomaLlon for creaLlng x rouLlnes l have LesLed ln our
envlronmenL wlLh Lhe example whlch you shown lLs worklng now l am Lrylng my own rouLlne wlLh
argumenLs

8egards
8avl SrlpaLhy

Pello
l wroLe Lhls code

#lnclude
#lnclude
#lnclude
uslng namespace sLd

float Max(char str,, char sep ) ,

vector myvector;

float n;

char mystr = new char;

strcpy(mystr,str);

char pch;

pch = strtok (mystr,sep);

while ( pch != NULL )

,

n=atof(pch);

myvector.push_back (n);

pch = strtok (NULL, sep);

,

return max_element(myvector.begin(),myvector.end());

,



when l complle ln uaLaSLage l have noL proble buL when l Lry Lo run Lhls error ls dlsplayed any
ldea???

1ransformer_198 lalled Lo load Lhe llbrary v0S198_1LS1_l_1ransformer_198so elLher Lhe
dlrecLory conLalnlng Lhe llbrary flle
ls noL on Lhe llbrary search paLh or Lhe llbrary was complled on a sysLem
LhaL ls lncompaLlble wlLh Lhls sysLem Could noL load v0S198_1LS1_l_1ransformer_198 ldso1
osh faLal relocaLlon error flle
/app/dsadm/AscenLlal/uaLaSLage/ro[ecLs//81_8106C/v0S198_1LS1_l_1ransformer_198so
symbol __1cCMaxlmo6lpc0_f_ referenced symbol noL found

Pello
l wroLe Lhls code

#lnclude
#lnclude
#lnclude
uslng namespace sLd


float Max(char str,, char sep ) ,

vector myvector;

float n;

char mystr = new char;

strcpy(mystr,str);

char pch;

pch = strtok (mystr,sep);

while ( pch != NULL )

,

n=atof(pch);

myvector.push_back (n);

pch = strtok (NULL, sep);

,

return max_element(myvector.begin(),myvector.end());




when l complle ln uaLaSLage l have noL proble buL when l Lry Lo run Lhls error ls dlsplayed any
ldea???

1ransformer_198 lalled Lo load Lhe llbrary v0S198_1LS1_l_1ransformer_198so elLher Lhe
dlrecLory conLalnlng Lhe llbrary flle
ls noL on Lhe llbrary search paLh or Lhe llbrary was complled on a sysLem
LhaL ls lncompaLlble wlLh Lhls sysLem Could noL load v0S198_1LS1_l_1ransformer_198 ldso1
osh faLal relocaLlon error flle
/app/dsadm/AscenLlal/uaLaSLage/ro[ecLs//81_8106C/v0S198_1LS1_l_1ransformer_198so
symbol __1cCMaxlmo6lpc0_f_ referenced symbol noL found

1hanks l solve Lhe problem
my rouLlne name Maxlmo ! Max
l change Lhe name and work flne
1hanks

Pl Lveryone
l am Lrylng yo use Lhe uaLasLage Al uSSeLLnvvar(uS8C!LC1 hro[ecLchar *Lnvvarnamechar
*value) l Lrled Lo creaLe a parallel rouLlne Lo use LhaL Al can someone help me or provlde Lhe C++
code Lo use LhaL Al

1hanks
rlro







1hank you for Lhe very useful posL )
my lnformaLlon server verslon ls 81 on Llnux and l have a problem openlng 8ouLlnes from my
daLasLage cllenL every Llme l Lend Lo creaLe a new arallel rouLlne lL glve me Lhe followlng errors
8un Llme error3 lnvalld procedure call or argumenL
8un Llme error429 AcLlvex componenL can noL creaLe ob[ecL

l have solved Lhls rouLlne relaLed problem on a 80 CllenL and server by downloadlng flx pack
ls_801fp1a

Anyone now how Lo geL Lhe equlvalenL flx pack for 81?

1hank you ln advance

1hls ls anka[any bdy have any suggesLlon Lo resolve Lhls lssue ?
LfpCofvof8aLe lalled Lo load Lhe llbrary
v333S2_d[pPewr2LCu_CClvCl_ln1L8lACL_PLW2_LfpCofvof8aLeo
elLher Lhe dlrecLory conLalnlng Lhe llbrary flle ls noL on Lhe llbrary search paLh or Lhe llbrary was
complled on a sysLem
LhaL ls lncompaLlble wlLh Lhls sysLem Could noL load
v333S2_d[pPewr2LCu_CClvCl_ln1L8lACL_PLW2_LfpCofvof8aLe
0309130 Symbol resoluLlon falled for
/daLa/ds/ro[ecLs/dpr_ohblcpL_uaL/81_8346C/v333S2_d[pPewr2LCu_CClvCl_ln1L8lACL_PLW
2_LfpCofvof8aLeo because
0309136 Symbol local1lmeSLamp__13A1_1lmeSLamplb (number 118) ls noL exporLed from
dependenL module /sysp/uaLaSLage/AscenLlal/uaLaSLage/xLnglne/llb/llborchalx3a(llbLempo)
0309022 CannoL load module
0309026 SysLem error CannoL run a flle LhaL does noL have a valld formaL
0309192 Lxamlne loader secLlon symbols wlLh Lhe dump 1v command


hank you for your posL
8uL lve a quesLlon whaL abouL memory leaks ? l mean ln your example you reference a sLaLlc
allocaLed sLrlng le dellmlLed sLrlng lf my code ls

char* geL_my_sLrlng(char *paramSLrlng)

// Memory allocaLed ln Lhe heap
char *p8esulL new char100
// uo someLhlng useful wlLh paramSLrlng and sLore Lhe resulL ln p8esulL
// 8eLurn
reLurn p8esulL


whaL happens Lo Lhe memory allocaLed by my rouLlne ? ls uaLaSLage responslble for deallocaLlng Lhe
memory ?
Moreover l should have wrlLLen someLhlng llke

char* geL_my_sLrlng(char *paramSLrlng)

// Memory allocaLed ln Lhe heap
char p8esulL100
// uo someLhlng useful wlLh paramSLrlng and sLore Lhe resulL ln p8esulL
// 8eLurn
reLurn (p8esulL0)


Lven Lhough Lhls code should complle lL could crash your sysLem (reference Lo a local varlable)

S-ar putea să vă placă și