Skip to content

Commit

Permalink
working prob1
Browse files Browse the repository at this point in the history
  • Loading branch information
v1j4y committed Jun 21, 2013
1 parent 061744c commit cdeb3ec
Show file tree
Hide file tree
Showing 48 changed files with 705 additions and 0 deletions.
16 changes: 16 additions & 0 deletions problem1/IRPF90_man/fact.l
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
.TH "IRPF90 entities" l fact "IRPF90 entities" fact
.SH Declaration
.nf
integer, allocatable :: fact (nfact)
.ni
.SH Description
! enter the factors
.SH File
.P
fact.irp.f
.SH Needs
limit
.br
.SH Needed by
sum
.br
16 changes: 16 additions & 0 deletions problem1/IRPF90_man/limit.l
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
.TH "IRPF90 entities" l limit "IRPF90 entities" limit
.SH Declaration
.nf
integer :: limit
integer :: nfact
.ni
.SH Description
! enter limit
.SH File
.P
limit.irp.f
.SH Needed by
fact
.br
sum
.br
16 changes: 16 additions & 0 deletions problem1/IRPF90_man/nfact.l
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
.TH "IRPF90 entities" l nfact "IRPF90 entities" nfact
.SH Declaration
.nf
integer :: limit
integer :: nfact
.ni
.SH Description
! enter limit
.SH File
.P
limit.irp.f
.SH Needed by
fact
.br
sum
.br
16 changes: 16 additions & 0 deletions problem1/IRPF90_man/sum.l
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
.TH "IRPF90 entities" l sum "IRPF90 entities" sum
.SH Declaration
.nf
integer :: sum
.ni
.SH Description
! calculates the sum of the factors of
! two integers between 1 to limit
.SH File
.P
sum.irp.f
.SH Needs
fact
.br
limit
.br
12 changes: 12 additions & 0 deletions problem1/IRPF90_temp/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
IRPF90 = irpf90 #-a -d
FC = gfortran
FCFLAGS= -O2

SRC=
OBJ=
LIB=

include irpf90.make

irpf90.make: $(wildcard *.irp.f)
$(IRPF90)
7 changes: 7 additions & 0 deletions problem1/IRPF90_temp/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
PROBLEM 1
----------

* If we list all the natural numbers below 10 that are multiples of 3 or 5, we
get 3, 5, 6 and 9. The sum of these multiples is 23.

Find the sum of all the multiples of 3 or 5 below 1000.
62 changes: 62 additions & 0 deletions problem1/IRPF90_temp/fact.irp.F90
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
! -*- F90 -*-
!
!-----------------------------------------------!
! This file was generated with the irpf90 tool. !
! !
! DO NOT MODIFY IT BY HAND !
!-----------------------------------------------!

subroutine provide_fact
use limit_mod
use fact_mod
implicit none
character*(12) :: irp_here = 'provide_fact'
integer :: irp_err
logical :: irp_dimensions_OK
if (.not.limit_is_built) then
call provide_limit
endif
if (allocated (fact) ) then
irp_dimensions_OK = .True.
irp_dimensions_OK = irp_dimensions_OK.AND.(SIZE(fact,1)==(nfact))
if (.not.irp_dimensions_OK) then
deallocate(fact,stat=irp_err)
if (irp_err /= 0) then
print *, irp_here//': Deallocation failed: fact'
print *, ' size: (nfact)'
endif
if ((nfact>0)) then
allocate(fact(nfact),stat=irp_err)
if (irp_err /= 0) then
print *, irp_here//': Allocation failed: fact'
print *, ' size: (nfact)'
endif
endif
endif
else
if ((nfact>0)) then
allocate(fact(nfact),stat=irp_err)
if (irp_err /= 0) then
print *, irp_here//': Allocation failed: fact'
print *, ' size: (nfact)'
endif
endif
endif
if (.not.fact_is_built) then
call bld_fact
fact_is_built = .True.

endif
end subroutine provide_fact

subroutine bld_fact
use limit_mod
use fact_mod
implicit none ! fact.irp.f: 6
character*(4) :: irp_here = 'fact' ! fact.irp.f: 1
integer :: i ! fact.irp.f: 7
write(6,*)'enter',nfact,'integers' ! fact.irp.f: 9
do i=1,nfact ! fact.irp.f: 10
read(5,*)fact(i) ! fact.irp.f: 11
enddo ! fact.irp.f: 12
end subroutine bld_fact
14 changes: 14 additions & 0 deletions problem1/IRPF90_temp/fact.irp.f
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
BEGIN_PROVIDER [integer, fact, (nfact)]
BEGIN_DOC
! enter the factors
END_DOC

implicit none
integer :: i

write(6,*)'enter',nfact,'integers'
do i=1,nfact
read(5,*)fact(i)
enddo

END_PROVIDER
12 changes: 12 additions & 0 deletions problem1/IRPF90_temp/fact.irp.module.F90
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
! -*- F90 -*-
!
!-----------------------------------------------!
! This file was generated with the irpf90 tool. !
! !
! DO NOT MODIFY IT BY HAND !
!-----------------------------------------------!

module fact_mod
integer, allocatable :: fact (:)
logical :: fact_is_built = .False.
end module fact_mod
Binary file added problem1/IRPF90_temp/fact.irp.module.o
Binary file not shown.
Binary file added problem1/IRPF90_temp/fact.irp.o
Binary file not shown.
28 changes: 28 additions & 0 deletions problem1/IRPF90_temp/fact_mod.mod

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

38 changes: 38 additions & 0 deletions problem1/IRPF90_temp/irp_stack.irp.F90
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@

module irp_stack_mod
integer, parameter :: STACKMAX=1000
character*(128),allocatable :: irp_stack(:,:)
double precision,allocatable :: irp_cpu(:,:)
integer,allocatable :: stack_index(:)
logical :: alloc = .False.
character*(128) :: white = ''
end module

subroutine irp_enter(irp_where)
use irp_stack_mod
integer :: ithread
integer :: nthread
character*(*) :: irp_where

!$OMP CRITICAL
ithread = 0
nthread = 1

!$OMP END CRITICAL


end subroutine

subroutine irp_leave (irp_where)
use irp_stack_mod
character*(*) :: irp_where
integer :: ithread
double precision :: cpu

!$OMP CRITICAL
ithread = 0


!$OMP END CRITICAL
end subroutine

Binary file added problem1/IRPF90_temp/irp_stack.irp.o
Binary file not shown.
42 changes: 42 additions & 0 deletions problem1/IRPF90_temp/irp_stack_mod.mod

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions problem1/IRPF90_temp/irp_touches.irp.F90
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
subroutine irp_finalize_367124922
use fact_mod
use sum_mod
use limit_mod
if (allocated(fact)) then
fact_is_built = .False.
deallocate(fact)
endif
end
Binary file added problem1/IRPF90_temp/irp_touches.irp.o
Binary file not shown.
43 changes: 43 additions & 0 deletions problem1/IRPF90_temp/irpf90.make
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
SRC += IRPF90_temp/irp_stack.irp.F90 IRPF90_temp/irp_touches.irp.F90 IRPF90_temp/prob1.irp.F90 IRPF90_temp/prob1.irp.module.F90 IRPF90_temp/fact.irp.F90 IRPF90_temp/fact.irp.module.F90 IRPF90_temp/sum.irp.F90 IRPF90_temp/sum.irp.module.F90 IRPF90_temp/limit.irp.F90 IRPF90_temp/limit.irp.module.F90
OBJ += IRPF90_temp/irp_stack.irp.o IRPF90_temp/fact.irp.o IRPF90_temp/fact.irp.module.o IRPF90_temp/sum.irp.o IRPF90_temp/sum.irp.module.o IRPF90_temp/limit.irp.o IRPF90_temp/limit.irp.module.o
OBJ1 = $(patsubst %, IRPF90_temp/%,$(notdir $(OBJ))) IRPF90_temp/irp_touches.irp.o
ALL = prob1
ALL_OBJ = prob1.irp.module.o prob1.irp.o
ALL_OBJ1 = $(patsubst %, IRPF90_temp/%,$(notdir $(ALL_OBJ)))
all:$(ALL)
@$(MAKE) -s move
prob1: IRPF90_temp/prob1.irp.o IRPF90_temp/prob1.irp.module.o $(OBJ1)
$(FC) -o $@ IRPF90_temp/$@.irp.o IRPF90_temp/$@.irp.module.o $(OBJ1) $(LIB)
@$(MAKE) -s move
IRPF90_temp/prob1.irp.o: IRPF90_temp/prob1.irp.module.o IRPF90_temp/sum.irp.module.o
IRPF90_temp/fact.irp.o: IRPF90_temp/fact.irp.module.o IRPF90_temp/limit.irp.module.o
IRPF90_temp/sum.irp.o: IRPF90_temp/sum.irp.module.o IRPF90_temp/limit.irp.module.o IRPF90_temp/fact.irp.module.o
IRPF90_temp/limit.irp.o: IRPF90_temp/limit.irp.module.o
IRPF90_temp/irp_touches.irp.o: IRPF90_temp/fact.irp.o IRPF90_temp/fact.irp.o IRPF90_temp/sum.irp.o IRPF90_temp/sum.irp.o IRPF90_temp/limit.irp.o IRPF90_temp/limit.irp.o
IRPF90_temp/%.irp.module.o: IRPF90_temp/%.irp.module.F90
$(FC) $(FCFLAGS) -c IRPF90_temp/$*.irp.module.F90 -o IRPF90_temp/$*.irp.module.o
IRPF90_temp/%.irp.o: IRPF90_temp/%.irp.module.o IRPF90_temp/%.irp.F90
$(FC) $(FCFLAGS) -c IRPF90_temp/$*.irp.F90 -o IRPF90_temp/$*.irp.o
IRPF90_temp/%.irp.o: IRPF90_temp/%.irp.F90
$(FC) $(FCFLAGS) -c IRPF90_temp/$*.irp.F90 -o IRPF90_temp/$*.irp.o
IRPF90_temp/%.o: %.F90
$(FC) $(FCFLAGS) -c $*.F90 -o IRPF90_temp/$*.o
IRPF90_temp/%.o: %.f90
$(FC) $(FCFLAGS) -c $*.f90 -o IRPF90_temp/$*.o
IRPF90_temp/%.o: %.f
$(FC) $(FCFLAGS) -c $*.f -o IRPF90_temp/$*.o
IRPF90_temp/%.o: %.F
$(FC) $(FCFLAGS) -c $*.F -o IRPF90_temp/$*.o
IRPF90_temp/%.irp.F90: irpf90.make

move:
@mv -f *.mod IRPF90_temp/ 2> /dev/null | DO_NOTHING=

clean:
rm -rf $(EXE) $(OBJ1) $(ALL_OBJ1) $(ALL)

veryclean:
- $(MAKE) clean

- rm -rf IRPF90_temp/ IRPF90_man/ irpf90.make irpf90_variables dist

4 changes: 4 additions & 0 deletions problem1/IRPF90_temp/irpf90_entities
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
fact.irp.f : integer, allocatable :: fact (nfact)
limit.irp.f : integer :: limit
limit.irp.f : integer :: nfact
sum.irp.f : integer :: sum
29 changes: 29 additions & 0 deletions problem1/IRPF90_temp/limit.irp.F90
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
! -*- F90 -*-
!
!-----------------------------------------------!
! This file was generated with the irpf90 tool. !
! !
! DO NOT MODIFY IT BY HAND !
!-----------------------------------------------!

subroutine provide_limit
use limit_mod
implicit none
character*(13) :: irp_here = 'provide_limit'
integer :: irp_err
logical :: irp_dimensions_OK
if (.not.limit_is_built) then
call bld_limit
limit_is_built = .True.

endif
end subroutine provide_limit

subroutine bld_limit
use limit_mod
character*(5) :: irp_here = 'limit' ! limit.irp.f: 1
write(6,*)'limit?' ! limit.irp.f: 6
read(5,*)limit ! limit.irp.f: 7
write(6,*)'nfact?' ! limit.irp.f: 8
read(5,*)nfact ! limit.irp.f: 9
end subroutine bld_limit
11 changes: 11 additions & 0 deletions problem1/IRPF90_temp/limit.irp.f
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
BEGIN_PROVIDER [integer, limit]
&BEGIN_PROVIDER [integer, nfact]
BEGIN_DOC
! enter limit
END_DOC
write(6,*)'limit?'
read(5,*)limit
write(6,*)'nfact?'
read(5,*)nfact

END_PROVIDER
Loading

0 comments on commit cdeb3ec

Please sign in to comment.