- Marcar como novo
- Marcador
- Subscrever
- Silenciar
- Subscrever fonte RSS
- Destacar
- Imprimir
- Denunciar conteúdo inapropriado
The post I made yesterday was not clear on many aspects as gurus have pointed out. The following is the code section inmy program:
FUNCTION FIND_LOC8(X,VAL,N)
INTEGER*8, INTENT(IN), DIMENSION(:) :: X
INTEGER*8, INTENT(IN) :: VAL
INTEGER*8 :: FIND_LOC8
INTEGER*8 :: I, N
! N = SIZE(X)
DO I=1, N
IF(X(I)==VAL) THEN
FIND_LOC8 = I
RETURN
END IF
END DO
FIND_LOC8 = 0
RETURN
END FUNCTION FIND_LOC8
My problem is, this simple function is inside 3-level of do-loops. As the loops become bigger, the time spent on this little function increase tramendously.
Can this simple code be optimized/vectorized/parallelized? Or, is there any more efficient internal routine/command that performs the same function but faster?
- Marcas:
- Intel® Fortran Compiler
Link copiado
2 Respostas
- Marcar como novo
- Marcador
- Subscrever
- Silenciar
- Subscrever fonte RSS
- Destacar
- Imprimir
- Denunciar conteúdo inapropriado
I believe that the question was answered satisfactorily in your previous thread on this topic, "How to optimize this simple code". It is expected on grounds of common courtesy that the originator of a question should read the answers given before posting a minor variation of the same question and starting a new thread.
By creating a new function such as FIND_LOC8 to determine the matching index, whereas the former code had inline Fortran code, you are making it more difficult for the compiler to optimize.
By creating a new function such as FIND_LOC8 to determine the matching index, whereas the former code had inline Fortran code, you are making it more difficult for the compiler to optimize.
- Marcar como novo
- Marcador
- Subscrever
- Silenciar
- Subscrever fonte RSS
- Destacar
- Imprimir
- Denunciar conteúdo inapropriado
By creating a new function such as FIND_LOC8 to determine the matching index, whereas the former code had inline Fortran code, you are making it more difficult for the compiler to optimize
So instead ofmaking the comparison aseparate function, make the comparison inline should make the conde runfaster?
So instead ofmaking the comparison aseparate function, make the comparison inline should make the conde runfaster?
Responder
Opções do tópico
- Subscrever fonte RSS
- Marcar tópico como novo
- Marcar tópico como lido
- Flutuar este Tópico para o utilizador atual
- Marcador
- Subscrever
- Página amigável para impressora