联系方式

  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-21:00
  • 微信:codinghelp

您当前位置:首页 >> C/C++编程C/C++编程

日期:2023-11-12 10:16

GRIFFITH COLLEGE DUBLIN

COMPUTING ASSIGNMENT TITLE SHEET

Course: BSCH Computing

Stage/Year: 4

Module: Distributed Systems

Semester: Semester I

Assignment Number: Assignment 2

Date of Title Issue: October 25th, 2023

Assignment Deadline: Two weeks after submission (see Moodle)

Assignment Submission: Moodle Upload

Assignment Weighting: 12.5%

Standard penalties will be applied to work that is submitted late, as per faculty guidelines.

Allwork must beyour own

Ifyoucopy from someone else,bothparties will be awardeda gradeof0.

UseofAItools such asOpenAIorChatGPT isstrictlyprohibited.Avoidtheuseofanyonline

resourcesexcepting Stack  Overflow.Donotshare your code anywhere.

Bysubmitting yourassignmentyouaccept thatyouunderstand  whatplagiarismis

andthatyour assignmentis not plagiarised in any way.

Anycasesofsuspected plagiarismwillbethoroughly investigated and may bebroughtin

forVIVA.

Learning Outcomes

Programmeandrelatedmodulelearningoutcomes that thisassignmentis assessing:

1,3

Assessment Criteria

Assessment criteria applied to this assignment, such as:

q Presentation

q Code Structure and Cleanliness

q Code Performance

q Appropriate Output

q Appropriate Method Selection

Assignment 2: Decode and Search

Ensureyour code iswellcommented,aswellasneatandreadable.Codethatfails

tocompilewillincur apenaltyof30%.

Workthatissubmitted late willincur standard penalties asperfacultyguidelines.

Forallprograms you write:print your nameandstudentnumbertotheconsole

once,andincludea comment atthetopwithyour fullname and studentnumber.

Youaregiven atemplatewhichincludesseveralhelpermethods.Usethistemplate

tocompletethetasksforpart1.

____________________________________________________________________________________________

Part 1 – MPI Program 50%

____________________________________________________________________________________________

The providedatemplate.cppfilecontainingseveralhelpermethods:

createData(),decryptText(),searchText(),andexportText(). Youdonotneedto

modifythesemethods,onlyinvokeasneeded.Youarealsoprovidedyourown

textfiletobedecodedandsearched. Includethis inthesamedirectoryasyour

executablefile.

Usethegiven template tocreate adistributed decryptionMPIprogramtoberun

using4nodes:

a) ThegiventextfileisencryptedwithatraditionalCaesarcipherusinga

keyfrom1-25.Thekeytobeusedtodecryptthetextfileshouldbetaken

from theuserinconsole byNode0.Thekeyshouldthenbebroadcastto

allothernodes.

Example: plaintext = ‘abcd’ key = 2 ciphertext = ‘cdef’

b) Node0willread the txtfileandstorethedataintoanarraybyinvoking

createData().Thearrayshouldthenbepartitionedintoequalsized

chunkstobedistributedamongallnodes.

c) Eachnodewilldecrypttheirgivenchunk usingthekeyprovidedin

consoleusingthedecryptText() function storedintoanewchararray

calleddecipheredArray.After decipheringthetext,eachnode will print its

decipheredarray.

d) EachnodewilltheninvokesearchData() onitsdecipheredpartialarrayto

findhowmanyinstancesoftheword“DISTRIBUTED” iscontainedin its

partition.Afterthefunctionis called,eachofthenodes will printitsrank

andtheamountofhitsfound.

e) Node3willcollecteachofthehitsfrom themultiplenodes and add these

together.Theresultsubsequentlyplacedintoanewvariable,which will

becalledtotalhits.Node2willoutputthisvariabletoconsoleinthe

format:“Distributed was found a total of <totalhits>

times.”

f) Eachnode will have adecrypted partialarray ofdifferingsizes.Use

strlen(partialArray)tostore thelength ofeachpartialarray.Node 0 will

collectallthepartialdecryptedtextarraysfrom each ofthenodes,store

intodecryptedTotalArray andexportasatextfilebyinvokingthe

exportText() function. Savethetextfileas<yourname>DecryptedText.txt

Includeinyoursubmission.

RemembertoclosetheMPIlibraryandreturncontroltotheOS.Ensureyour

codewillworkwithaworldsizeof4.

____________________________________________________________________________________________

Part 2 – Documentation 40%

____________________________________________________________________________________________

Youareto writea reportrelatingto yourcode forpart1.This  is acompulsory

partofyoursubmission.Anysubmissionsthatdonotincludeareportwill

receiveanautomatic0.

Usetheprovidedtemplatetocompleteyour report.Answereachquestioninthe

report,providingexplanations,diagrams andscreenshotsasrequested.

RemembertochangetheName and StudentNumberatthetopofthereport,and

saveasaPDF.

Youwillalsobegradedonthequality of your code.Ensureanycode  you submit

isrobust,wellcommented,andwellstructured.

Alwaysincludeacommentatthetopofyour code with your nameandstudent

number,andoutputthesetoconsoleonce.

Submityour .cpp file (donotincludeheaderor makefiles) andpdfreport

archivedintoa.zip file.

Tips:

T Keepyour code simple: Coordinator()andParticipant()notneeded.

T Readthebrief,thenreaditagain.Thenreadthebrief.

T Ensureyourcodeistidyandreadable.

T Includeappropriatecomments.

T Makesureyour code compiles and  runs correctly.

o Anythingnotworking,comment outandtellmewhy.

T Information thatyououtputto console shouldbeclear andconcise.

o For example,your name/numbershouldonlybeprintedonce

T Use the most appropriateMPIfunctionforthetask.

T Use the provided template and helper methods.


版权所有:编程辅导网 2021 All Rights Reserved 联系方式:QQ:99515681 微信:codinghelp 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。 站长地图

python代写
微信客服:codinghelp