- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dear all,
I'm a wildlife scientist working in Sweden, and I would like to ask some naive questions.
I develop population models for wildlife managent purpose. The current models I have written (in R or Objective C) are too slow for complex simulations, so I have decided to give Fortran and Intel Fortran Compiler a try, as everyone tells they can make very fast programs. The powerfull array and vector manipulation features seem also very attractive. However, I'm encountering difficulties in using the MKL, and this probably because I'm not really familiar with command line compilation on UNIX. I suppose most of list members here are UNIX fluent, so my questions will likely take just a few seconds of your time. Thanks for your help!
I have for example this very simple program:
!#######################################################################
program model
integer :: i
real, allocatable :: pop(:)
real :: s
allocate(pop(1:100))
pop = 1
s = 0.99
do i=1,100
pop = pop*s
end do
print *, pop
end program model
!#######################################################################
What I'm unable to do is to have something like:
do i=1,100
pop = bernoulli(pop,s)
end do
For this I need to link with the MKL and use the function virngbernoulli( method, stream, n, r, p ) contained in include/mkl_vml.fi
I have tried to link by typing this:
ifort -std03 model.f90 -I/opt/intel/Compiler/11.0/056/Frameworks/mkl/include/mkl_vsl.fi
but this does not work. Neither does
ifort -std03 model.f90 -I/opt/intel/Compiler/11.0/056/Frameworks/mkl/include/
when I put include 'mkl_vsl.fi' in the program
I'm using Mac OS 10.5.5, with the latest evaluation version of the Intel Fortran Compiler. I need to use the -std03 option, as once I have this working, I would like to keep only the "1" in the array, and I suppose I can do it like this:
WHERE (pop == 1)
pop = pop
END WHERE
Well, probably simple for you. Thanks for any help I could get!
Cheers
Guillaume
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You've already made this question too complicated for a beginner. For example, where you wrote
do i=1,100
pop = pop*s
end do
This has the same meaning as
do i=1,100
do j=1,100
pop(j) = pop(j)*s
end do
end do
The compiler may or may not do exactly what you intended, and I don't know what you intended. Even if I make the assumption that you didn't write this by mistake, it becomes impossible to give you a simple answer.
WHERE (pop == 1)
Is a way to select those array indices corresponding to elements of pop which have the exact value 1. This raises several issues which may not bear on the question you intended to ask.
MKL is primarily oriented toward Fortran 77 (no array syntax), although the BLAS95 interface provides some relief. There is a separate forum section on MKL.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for your reply. In fact, my code was written to do exactly what you described. This looks very similar to R syntax, so it would require very few efforts to port a R simulation program to Fortran 2003 (which would run much faster). The Fortran 2003 feature of allocatable arrays in assigment statements is very useful for this. Thanks for the explanation about the MKL and its lack of vector support.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You've already made this question too complicated for a beginner. For example, where you wrote
do i=1,100
pop = pop*s
end do
This has the same meaning as
do i=1,100
do j=1,100
pop(j) = pop(j)*s
end do
end do
The compiler may or may not do exactly what you intended, and I don't know what you intended. Even if I make the assumption that you didn't write this by mistake, it becomes impossible to give you a simple answer.
WHERE (pop == 1)
Is a way to select those array indices corresponding to elements of pop which have the exact value 1. This raises several issues which may not bear on the question you intended to ask.
MKL is primarily oriented toward Fortran 77 (no array syntax), although the BLAS95 interface provides some relief. There is a separate forum section on MKL.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page