How to create "Copilot" for Fortran?

How many lines of code are needed to get useful results from Copilot? I wonder if it could be useful for restricted codebases at the personal or research group level. I have written about 600K lines of code. Would Copilot make useful suggestions to me if trained on my code? Or just help me write the same buggy code faster :slight_smile:

Can machine learning be used to spot legal code that may be buggy, as in the codes below? (Implicit none might catch the latter, but not if both yy and y are declared variables.)

do i1=1,n1
   do i2=1,n2
      do i3=1,n2 ! should be n3
      end do
   end do
end do
select case (dist)
   case ("normal")  ; yy = one_over_sqrt_two_pi * exp(-0.5*xx**2)
   case ("Laplace") ; yy = 1/(sqrt_two)*exp(-sqrt_two*abs(xx))
   case ("sech")    ; yy = sech(pi_over_2*xx)/2
! line below should have yy
   case ("t5")      ; y = student_t_density(xx,dof=5.0_dp,mu=0.0_dp,xsd=1.0_dp) 
   case ("t10")     ; yy = student_t_density(xx,dof=10.0_dp,mu=0.0_dp,xsd=1.0_dp)
   case default     ; yy = bad_real
end select
2 Likes