Windows 10 vs Linux with Julia and VSCode

Hi,
I just buy new notebook with NVidia card and installed an Ubuntu on him(primarily I tried to install Mint on it, but it crashes all the time - black screen and nothing to do ), but there was too many problems with drivers, when I pull through the problems with video card driver, I started to run my program, but it run very slowly(about 20 times slower than on earlier stuff) I made even tests on this site and on Ubuntu I have score P443(it last very long to finish this test), on Windows 10(I had dualboot) P6500. So I decided to switch to Windows(for example on my previous notebook it gave P1040 on Windows andthe same score on Mint). I installed VSCode and Julia, run my program and … the same problem occured.


In this program I left print() statements to watch the actual steps so I know that it didn’t crash(as I write this topic it didn’t even achieve 10% of actual calculation, but it “works”).
The most important problem is with this part of code:

module BiotSavartCalculation
using QuadGK: quadgk
export biotSavartCalculation

function biotSavartCalculation(x,y,z,Segment,I,SegmentsOnElement)
  E=length(Segment)
  T=Array{Float32}(undef,E*SegmentsOnElement,3)
  variant=Array{Float32}(undef,E)
  for j=1:E
    if ((Segment[j][2][1]==Segment[j][1][1])&&(Segment[j][2][2]==Segment[j][1][2]))
      variant[j]=1.0f0
    elseif Segment[j][2][3]==Segment[j][1][3]
      variant[j]=2.0f0
    else
      variant[j]=3.0f0
    end
    start=(j-1)*SegmentsOnElement+1
    over=j*SegmentsOnElement
    for i=start:over
      k=(i-1)%SegmentsOnElement
      T[i,1]=Segment[j][1][1]+k*(Segment[j][2][1]-Segment[j][1][1])/(SegmentsOnElement-1)
      T[i,2]=Segment[j][1][2]+k*(Segment[j][2][2]-Segment[j][1][2])/(SegmentsOnElement-1)
      T[i,3]=Segment[j][1][3]+k*(Segment[j][2][3]-Segment[j][1][3])/(SegmentsOnElement-1)
    end
  end
    B=Array{Float32}(undef,length(x),length(y),length(z))
    m=1;
    for z in z
      for y in y
        for x in x
          Bx=0.0
          By=0.0
          Bz=0.0
          for j=1:E
            start=(j-1)*SegmentsOnElement+1
            over=j*SegmentsOnElement-1
            if variant[j]==1.0
              for i=start:over
                L=T[i+1,3]-T[i,3]
                δx=x-T[i,1]
                δy=y-T[i,2]

                q=δx*δx+δy*δy
                try
                  integral, err = quadgk(u -> ((u-z)^2+q)^(-3/2), 0, L, rtol=1e-8)
                catch
                end
                Bx+=I[j]*integral*δy
                By+=I[j]*integral*δx
              end
            elseif variant[j]==2.0
              for i=start:over
                δx=x-T[i,1]
                δy=y-T[i,2]
                δz=z-T[i,3]

                Sx=T[i+1,1]-T[i,1]
                Sy=T[i+1,2]-T[i,2]
                L=sqrt(Sx*Sx+Sy*Sy)

                α=Sx/L
                β=Sy/L


                p=α*δx+β*δy
                q=δx*δx+δy*δy+δz*δz-p*p
                integral=0.0

                try
                  integral, err = quadgk(u -> ((u-p)^2+q)^(-3/2), 0, L, rtol=1e-8)
                catch
                end

                Bx+=I[j]*integral*β*δz
                By+=I[j]*integral*α*δz
                Bz+=I[j]*integral*(α*δy-β*δx)
              end
            else
              for i=start:over
                δx=x-T[i,1]
                δy=y-T[i,2]


                Sx=T[i+1,1]-T[i,1]
                Sy=T[i+1,2]-T[i,2]



                L=sqrt(Sx*Sx+Sy*Sy)
                mi=(T[i+1,3]-T[i,3])/Sy
                if mi==Inf
                  mi=(T[i+1,3]-T[i,3])/(Sy+0.01)
                end

                α=Sx/L
                β=Sy/L
                a=1+mi*mi
                δz=z+mi*T[i,2]-T[i,3]

                p=(α*δx+β*δy+mi*δz)/a
                q=δx*δx+δy*δy+δz*δz-p*p*a
                integral=0.0
                try
                  integral, err = quadgk(u -> (a*(u-p)^2+q)^(-3/2), 0, L, rtol=1e-8)
                catch
                end



                Bx+=I[j]*integral*(β*δz-mi*δy)
                By+=I[j]*integral*(α*δz-mi*δx)
                Bz+=I[j]*integral*(α*δy-β*δx)
              end
            end

          end
          B[m]=sqrt(abs(Bx)*abs(Bx)+abs(By)*abs(By)+abs(Bz)*abs(Bz))/(4*pi)
          m+=1
        end
        println(y)
      end
    end
  return B
end

end

On previous(theoretically weaker) notebook it taked about 20 seconds.
And there is also a problem that I can’t
(v1.0) pkg> dev ~/.julia/dev/PackageName
to add my local package, but I must do it through github(made a package on dev folder, send to repository and clone it:
(v1.0) pkg> dev https://github.com/username/PackageName.git
which is little annoying.

What do you think, is there any idea to solve this problem? Is there the way to work with Julia on Windows or is any Linux distribution, which wouldn’t have a problem with my chipset drivers(I have Intel-Core i5-8300H CPU 2.3GHz and NVidia Geforce GTX 1050 video card)?

It is not clear what your problem is.

  1. If you need help optimizing your program, I am not sure how the hardware/OS is relevant.

  2. If you need help with drivers for your hardware, that is outside the scope of this forum, you may want to try somewhere else.

  3. As for the package dev problem, that may be a third, entirely unrelated question. If you need help debugging this, please make sure that the path actually exists, and include an error message.

1 Like

@wiktorkujawa I have a dual boot laptop - Windows 10 and Fedora. I have never had problems with drivers and running Julia. I must say though that I do not have Nvidia graphics - just the onboard Intel.

Please take a step back.
Are you asking about running Julia on Windows or on Ubuntu?
Are you able to run other graphics intensive programs without crashes?
I usually use Unigine for stress testing https://benchmark.unigine.com/

Please run one of these benchmarks on Ubuntu and on Windows and let us know what happens.

1 Like

As I said above, I don’t think this forum is the right place for generic Linux/Windows support, unless the question is related to Julia. In this case, it is not clear that it is.

These CImGui applications works correct. I think that there is the problem with calculation code. However the plot wasn’t generated after doing all calculations.
There is no problem with code, because the same code works perfectly fine on other(older) equipment.
So:

  • I changed the system - Julia/VSCode works very slow

  • Wanted to do it on Linux system - system isn’t compatible with drivers, Mint with GPU(and maybe with CPU too, but I can’t test it), Ubuntu with CPU(and maybe with GPU, but I didn’t tested it, because that above 10 times slower CPU was big enough trouble)

  • I don’t know if that means something, but now I have 64-bit system(procesor x64).

Please take this offline as Tamas Papp points out. I have sent you a message.

2 Likes

Problem solved, I have x64 procesor(not x86). I changed all Float32->Float64 and delete all 0f casts and it made all calculations two times faster than using old notebook.
I used these Float32 and al 0f casts because in future my program will be implemented with CUDA and my video card have about 32 times better float performance than double performance.