mrakgr / The-Spiral-Language

Functional language with intensional polymorphism and first-class staging.
Mozilla Public License 2.0
919 stars 27 forks source link

More compiler config options #6

Closed kevmal closed 6 years ago

kevmal commented 6 years ago

I got distracted for a bit but just found some time to get back to this...

Some of these hard-coded version numbers need to be extracted as options:

https://github.com/mrakgr/The-Spiral-Language/blob/4e785768624c298d3386c08f30321e8f9dee9a71/The%20Spiral%20Language/SpiralLib.fs#L1666-L1670

I needed to change vcvars_ver , the others haven't caused any issues so far despite not lining up.

mrakgr commented 6 years ago

A good idea. Originally I meant to track the latest version of CL, but it turned out NVCC needed the old one. Can I take this to mean that the newest Cuda SDK now supports the latest version of CL? It has been a while since I last did an upgrade.

I think what I will do tomorrow is make those paths a part of compiler options and make a global cfg variable with the defaults which will make it easy to immutably update it rather than having it be copy pasted which is the current situation.

kevmal commented 6 years ago

Can I take this to mean that the newest Cuda SDK now supports the latest version of CL?

Doesn't seem like it. I was running Cuda 9.1 and had 14.14 toolset installed and it was a no go so originally I just switched over to 14.0. Just tried Cuda 9.2 and it's still not supported. I suppose I should add 14.11 to my VS install at some point but for the time being its easier to just set the option to 14.0.

mrakgr commented 6 years ago

This should do it.

Now SpiralTypes.fs has the following record that has the defaults on my machine.

let cfg_default = {
    cub_path = "C:/cub-1.7.4"
    cuda_path = "C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v9.0"
    cuda_nvcc_options = "-gencode=arch=compute_52,code=\\\"sm_52,compute_52\\\""
    vs_path = "C:/Program Files (x86)/Microsoft Visual Studio/2017/Community"
    vs_path_vcvars = "VC/Auxiliary/Build/vcvarsall.bat"
    vcvars_args = " x64 -vcvars_ver=14.11"
    vs_path_cl = "VC/Tools/MSVC/14.11.25503/bin/Hostx64/x64"
    vs_path_include = "VC/Tools/MSVC/14.11.25503/include"
    cuda_includes = ["cub/cub.cuh"]
    trace_length = 40
    cuda_assert_enabled = false
    }

You can immutably update it like this:

let cfg_testing = {cfg_default with cuda_includes=[]; trace_length=20}

You can access it from a different module as so.

let cfg = Spiral.Types.cfg_default

At the moment cfg_testing is used in the Testing project and the default one is used in the other two projects.

I haven't factored out all the possible compiler options, but I will do so if needed. It is fine if you ask, so let me know if you have any other requests.