Visit Our UNIX and Linux User Community

Help with make this Fortran code more efficient (in HPC manner)

Thread Tools Search this Thread
Top Forums Programming Help with make this Fortran code more efficient (in HPC manner)
# 1  
Old 10-18-2011
Question Help with make this Fortran code more efficient (in HPC manner)

Hi there,

I had run into some fortran code to modify. Obviously, it was written without thinking of high performance computing and not parallelized... Now I would like to make the code "on track" and parallel. After a whole afternoon thinking, I still cannot find where to start. Can any one help me on how to HPC and parallel the code? Thank you very much.


DO I=1,N
        DO J=1,N
         XXX= 0.0D+00
               DO K=1,N
                     DO L=1,N
                            XXX = XXX + C(K,I)*CABM(K,L)*C(L,J)
               IF(I.eq.J) XXX=XXX-1.0d0

# 2  
Old 10-20-2011
This one's not too hard. You're summing up all the subexpressions of I,k,j,l. Each iteration can be dine on a separate node and "reduced" to a single sum.

Perhaps the easiest way would be to parallelize the outermost loop, splitting the task among N processors and summing each result.

Do you have an MPI environment?
# 3  
Old 10-20-2011
Hi, yes, I do have a MPI environment. However, I am not too familiar with MPI but OpenMP. And after a few days of thinking, I think I can parallelize the code successfully using OpenMP. And you were right, the best performance I got is to parallel the outer most loop. Thank you for your help.
# 4  
Old 10-20-2011
As I understand it, openmp is limited to parallelization on a single shared-memory node. But I may be several years out of date there.

Previous Thread | Next Thread
Test Your Knowledge in Computers #813
Difficulty: Medium
The CSS RGBA alpha parameter defines the opacity as a number between 1.0 (fully transparent) and 0.0 (fully opaque).
True or False?

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Combining awk command to make it more efficient

VARIABLE="jhovan 5259 5241 0 20:11 ? 00:00:00 /proc/self/exe --type=gpu-process --channel=5182.0.1597089149 --supports-dual-gpus=false --gpu-driver-bug-workarounds=2,45,57 --disable-accelerated-video-decode --gpu-vendor-id=0x80ee --gpu-device-id=0xbeef --gpu-driver-vendor... (3 Replies)
Discussion started by: SkySmart
3 Replies

2. Programming

Removing goto statements in FORTRAN code

I have the code below and I want to remove the "go to" statements. Any idea how I can do it? if (iorder == 0) then tmincurrent = 1.0e11 if(ireverse == 0 .or. istop /= 1) then do i = 1, 6 if ((side(i) /= sidelimit(i)) .and. (tminside(i) < tmincurrent)) then ... (1 Reply)
Discussion started by: kristinu
1 Replies

3. Shell Programming and Scripting

How to sort and compare files in more efficient manner?

Hello All, Iam using below method to sort and compare files. First iam doing sorting and changing the same file and then doing comparing and taking the final result to another file. sort -o temp.txt file1 mv temp.txt file1 sort -o temp.txt file2 mv temp.txt file2 sort -o temp.txt... (6 Replies)
Discussion started by: Vikram_Tanwar12
6 Replies

4. Shell Programming and Scripting

Efficient rewrite of code?

egrep -v "#" ${SERVERS} | while read shosts do grep -Pi "|" ${LOGFILE} | egrep "${snhosts}" | egrep "NOTIFICATION:" | awk -F";" '{print $3}' | sort -n | uniq | while read CEXIST do ... (6 Replies)
Discussion started by: SkySmart
6 Replies

5. Programming

Using Doxygen on Fortran code

I am using doxygen for documenting my fortran code. I want to write some notes after the header in different parts of the subroutine. Any idea what the tags should be as anything I write after the header is not displayed ... (0 Replies)
Discussion started by: kristinu
0 Replies

6. Programming

Error running FORTRAN code

Hi, I am new to this forum and do not know whether this is the appropriate place to post this question. Anyway am trying my luck. I have a fortran program swanhcat.ftn, which is part of a wave modelling system. There is also a file hcat.nml which is required to run this program. The program's... (9 Replies)
Discussion started by: sandhyakg
9 Replies

7. Emergency UNIX and Linux Support

Help to make awk script more efficient for large files

Hello, Error awk: Internal software error in the tostring function on TS1101?05044400?.0085498227?0?.0011041461?.0034752266?.00397045?0?0?0?0?0?0?11/02/10?09/23/10???10?no??0??no?sct_det3_10_20110516_143936.txt What it is It is a unix shell script that contains an awk program as well as... (4 Replies)
Discussion started by: script_op2a
4 Replies

8. Programming

Making FORTRAN code more efficient

Hi, I have a very large, very old FORTRAN code that I work with. The code is quite messy and I was wondering if I can speed up execution time by finding subroutines that code execution spends the most time in. Is there any kind of software I can use to see where the code spends most of the... (1 Reply)
Discussion started by: rks171
1 Replies

9. Shell Programming and Scripting

Is there a way to make this more efficient

I have the following code. printf "Test Message Report" > report.txt while read line do msgid=$(printf "%n" "$line" | cut -c1-6000| sed -e 's///g' -e 's|.*ex:Msg\(.*\)ex:Msg.*|\1|') putdate=$(printf "%n" "$line" | cut -c1-6000| sed -e 's///g' -e 's|.*PutDate\(.*\)PutTime.*|\1|')... (9 Replies)
Discussion started by: gugs
9 Replies

Featured Tech Videos