Hi,
I am working on an MPI project using vb.net. If there is anyone in here that has experience using MPI.NET which is distributed by Indiana.edu please get back to me. I am having several unexplainable issues with this SDK and someone with experience migh have some tips that I could use.
I am particularly having issues working with large data files. The program that I am working on works fine with files upto 150MB but starts to fail with anything larger.
I am using Windows XP prof. and the system is a 1.8 Ghz with 1 GB of RAM.
The program i am writing simply reads a text file and then find the number of occurences of a "seaerchter m" in the file.
Thanks.
Rob
Here is the code: -
Imports System.IO
-
Imports System.Threading.Tasks
-
Imports System.Diagnostics
-
Imports System.Text
-
Imports System.Text.RegularExpressions
-
-
-
Module Module1
-
Dim FS As FileStream
-
Dim comm As MPI.Intracommunicator
-
Dim AllocationSize As Long
-
Dim StartPos As Long
-
Dim EndPos As Long
-
Dim FileName As String
-
Dim FileSize As Long
-
Dim TextToRead As StringBuilder
-
Dim mode As String
-
Dim SearchTerm As String
-
Dim matchCount As Long = 0
-
-
-
Sub Main()
-
-
Dim env As MPI.Environment = New MPI.Environment(Split(Command, " "))
-
comm = MPI.Communicator.world
-
-
Dim sw As New Stopwatch
-
sw.Start()
-
-
If Command() = "" Then
-
Console.WriteLine("Please enter a valid filename to be processed.")
-
Exit Sub
-
Else
-
Dim args As String() = Split(Command, ",")
-
FileName = args(0)
-
SearchTerm = args(1)
-
End If
-
-
'read in the file to be processed
-
FS = New FileStream(FileName, FileMode.Open, FileAccess.Read, FileShare.Read)
-
FileSize = FS.Length
-
-
If comm.Size > FileSize Then
-
Console.WriteLine("Quitting. Too many cooks spoil the broth.")
-
Exit Sub
-
End If
-
AllocationSize = Fix(FileSize / comm.Size)
-
-
If comm.Rank = comm.Size - 1 Then
-
-
StartPos = (comm.Rank * AllocationSize) + 1
-
EndPos = FileSize
-
Else
-
StartPos = (comm.Rank * AllocationSize) + 1
-
EndPos = (comm.Rank + 1) * AllocationSize
-
End If
-
-
'______________________________________________________________
-
Dim br As New StreamReader(FS)
-
br.BaseStream.Seek(StartPos, SeekOrigin.Begin)
-
Dim WordLen As Integer = SearchTerm.Length - 1
-
Dim matches As Boolean = False
-
Dim posCounter As Long = StartPos
-
Dim i As Integer
-
Dim c As Integer
-
Console.WriteLine("TypeOf c is " & c.GetType.ToString)
-
Console.WriteLine("TypeOf i is " & i.GetType.ToString)
-
Console.WriteLine("TypeOf wordlen is " & WordLen.GetType.ToString)
-
Console.WriteLine("TypeOf ascw searchterm.char is " & AscW(SearchTerm.Chars(0)).GetType.ToString)
-
-
Do 'br.Peek <> -1
-
c = br.Read
-
posCounter = posCounter + 1
-
If c = AscW(SearchTerm.Chars(0)) Then
-
Console.Write("")
-
matches = True
-
For i = 1 To WordLen
-
c = br.Read
-
posCounter = posCounter + 1
-
If c = AscW(SearchTerm.Chars(i)) Then 'And posCounter <= EndPos Then
-
matches = True
-
Else
-
matches = False
-
Exit For
-
End If
-
Next
-
Else
-
matches = False
-
End If
-
-
If matches = True Then
-
matchCount += 1
-
matches = False
-
End If
-
-
Loop While posCounter <= EndPos
-
-
Console.WriteLine(comm.Rank & " found: " & matchCount & " between " & StartPos & "->" & posCounter)
-
br.Close()
-
'______________________________________________________________
-
-
-
-
'DoWordSearch()
-
'DoFileRead()
-
'DoFileWrite(TextToRead.ToString)
-
'Console.WriteLine("Worker {0} found {1} occurence.", comm.Rank, FindStringCount(TextToRead.ToString))
-
-
Dim TotalMatches = comm.Reduce(Of Long)(matchCount, MPI.Operation(Of Long).Add, 0)
-
If comm.Rank = 0 Then
-
Console.WriteLine("Done Processing (MapReducing) and writing processed contents to \\{0}", MPI.Environment.ProcessorName & "\MPI\Output.txt")
-
Console.WriteLine("Total matches found - " & TotalMatches)
-
End If
-
-
sw.Stop()
-
Dim MaxTime As Long = sw.ElapsedMilliseconds
-
Dim TimeToProcess As Long = comm.Reduce(Of Long)(MaxTime, MPI.Operation(Of Long).Max, 0)
-
If comm.Rank = 0 Then
-
Console.WriteLine()
-
Console.WriteLine("The parallel read and write operation tooka max of:{0} milliseconds with a file of size {1}", TimeToProcess, FileSize)
-
Console.WriteLine()
-
End If
-
-
FS.Close()
-
comm = Nothing
-
env.Dispose()
-
-
End Sub
-
0 1034 Sign in to post your reply or Sign up for a free account.
Similar topics |
by: eric cocozza |
last post by:
Hi,
I just moved a python program to a new server, and I'm getting path errors.
It relys on the pear library and a image processing one.
Please respond with cost based on 1/hr of work, and please accept paypal, or
other simple form of payment.
Thanks!
|
by: clinton Brandt |
last post by:
Hey I am Learning Blender for 3D mesh design and the current Relese doesnt
recognize my python 2.4.1 it stopped at python 2.3. there alpha test of
their next release supports py 2.4 but as a noob id like to learn an a less
buggy release. so my question is can i install 2 versions of python and if i
do, does the newer version hold rank when running .py files. or should i axe
the version i have and the start with 2.3 then load 2.4 or what?...
|
by: Vai2000 |
last post by:
Hi All, To my correct understanding Garbage Collection works based on
Generation algorithm...(high level).
I have an application which does some heavy operations usually File I/O's. I
want to force garbage collection on this class. I still want the GC to
release all resources before finalizing etc...but I want GC to kick in ASAP,
rather waiting to execute its algo to detect that this class needs cleaning
up and finally come to its...
|
by: Carlos Fernandez |
last post by:
Note: More evidence that the below scenario is a compiler bug is that it works when compiled as a static lib; it only fails as a .dll
--------------------
Define a managed class with a method that takes a template parameter
public __gc class UtilClass
public
UtilClass()
void ConvertSomething( System::String *inString, NativeClass<int>&outType );
}
|
by: Jstone |
last post by:
Hi all. I know this group is devoted to Javascript but I thought someone may
be able to answer a couple questions for me. First, is there a way to
customize the border of a Flash MX projector with Actionscript? By customize
I mean to remove the border and add my own with my own buttons. I know there
is software that will do it but they usually provide a gallery of border
skins to choose from. I thought Swish Studio would let me design my...
| |
by: Guy Cohen |
last post by:
Hi all.
My webhost prepared a server for me with 2000 instead of 2005.
Will my .net 2005 application work there?
I generated a script to export my sql server 2005 object
There was a failure here:
IF NOT EXISTS (SELECT * FROM sys.database_principals WHERE name =
N'aspnet_WebEvent_FullAccess' AND type = 'R')
CREATE ROLE
|
by: frien |
last post by:
I want to create a stored procedure to find if the index exists if not
i have to create the index....i use following stored procedure....but
does'nt seem to be working.......but when i hard code the query it does
work... can u plz tell me were i am going wrong
CREATE PROCEDURE .
@tblName varchar(255),
@colName varchar(255),
@indName varchar(255)
AS
|
by: =?Utf-8?B?ZG5vcnJpcw==?= |
last post by:
Please let me know if I'm posting as an "MSDN subscrber"?
I'm not getting responses to my posts for days.
Thanks
|
by: blogman |
last post by:
I am getting a Visual studio 2008 IDE application R6034 runtime error. This
means that the IDE application is raising the error not the application I am
building. This means that Microsoft did not follow its own advice as listed
in http://msdn.microsoft.com/en-us/library/ms235560(VS.80).aspx and "build
with a manifest". The DLL in question seems to be msvcr8.0.dll which is the
VS2005 C runtime DLL. I am not sure why this is an issue in a...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |