Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Snektron
    @snektron:matrix.org
    [m]
    problem is cudart and nvrtc aren't in the default path, i think only nvcc can find them easily. I might be able to hack around that simply by querying the path using nvcc
    Snektron
    @snektron:matrix.org
    [m]
    @athas: theres a problem with the #ifdef __cplusplus in the generated headers
    they should not be around the other includes, only around the header's body
    sorry i didn't contribute it myself btw
    Last time i tried to build futhark it took a really long time and i'm not comfortable with making a pr without testing
    Troels Henriksen
    @athas
    Is it a problem that they surround the other headers? I guess it might be. I'll move it.
    Snektron
    @snektron:matrix.org
    [m]
    Yes
    it causes cuda.h to be interpreted as a c header when using from c++
    they probably provide some extended functionality for c++
    but then the header is interpreted as a c header and compilation fails
    Troels Henriksen
    @athas
    @snektron:matrix.org OK, I changed it, try again.
    Snektron
    @snektron:matrix.org
    [m]
    just waiting for the CI to finish :)
    Snektron
    @snektron:matrix.org
    [m]
    It works
    Snektron
    @snektron:matrix.org
    [m]

    Orestis: i settled on the following, which now also supports cuda:

    meson_options.txt:

    option('futhark-backend', type: 'combo', choices: ['c', 'multicore', 'opencl', 'cuda'], value: 'c', description: 'Select the backend that Futhark code compiles to')

    meson.build:

    dependencies = []
    
    # Build futhark library
    futhark = find_program('futhark')
    futhark_backend = get_option('futhark-backend')
    futhark_generated = custom_target(
        'futhark',
        input: 'src/main.fut',
        output: ['futhark-generated.c', 'futhark-generated.h'],
        command: [futhark, futhark_backend, '@INPUT@', '--library', '-o', 'futhark-generated']
    )
    
    if futhark_backend == 'multicore'
        dependencies += dependency('threads')
    elif futhark_backend == 'opencl'
        dependencies += dependency('OpenCL')
    elif futhark_backend == 'cuda'
        dependencies += dependency('cuda', modules: ['cuda', 'cudart', 'nvrtc'])
    endif
    
    # Final executable
    executable(
        'my_exe',
        [sources, futhark_generated],
        dependencies: dependencies,
    )
    Orestis
    @omhepia:matrix.org
    [m]
    Snektron: works very nicely thanks a lot!
    Orestis
    @omhepia:matrix.org
    [m]
    hello. how is the futhark test header parsed? is there a way to get the header and convert it into a text file?
    Troels Henriksen
    @athas
    What do you mean "convert it into a text file"?
    There is a parser defined for it in Haskell code. I wouldn't mind adding commands for extracting that information in another format, if it would be useful.
    Orestis
    @omhepia:matrix.org
    [m]
    I mean maybe just redirect to stdout or write it in a file so it's easy to pipe it into the tests executable manually
    Troels Henriksen
    @athas
    Ah, you mean the datasets specifically? There is a futhark dataget tool you can use for that.
    Orestis
    @omhepia:matrix.org
    [m]
    Yes. I missed that one. Thanks I'll look into it.
    Orestis
    @omhepia:matrix.org
    [m]
    how do i identify the datasets if there are more that 1?
    Troels Henriksen
    @athas
    By the same name that 'futhark bench' uses for it.
    Usually a prettyprinted prefix of its contents.
    Orestis
    @omhepia:matrix.org
    [m]
    like ?
    futhark dataget program.fut #0
    Troels Henriksen
    @athas
    Try it and it'll tell you which names will work.
    Orestis
    @omhepia:matrix.org
    [m]
    ```

    futhark dataget test.fut 0
    Dataset '0' ambiguous:

    #0 ("[4i32, 3i32, 2i32, 1i32] 1i32")

    #1 ("[4i32, 3i32, 2i32, 1i32] 0i32")

    ```

    -- Test simple indexing of an array.
    -- ==
    -- tags { firsttag secondtag }
    -- input { [4,3,2,1] 1 }
    -- output { 3 }
    -- input { [4,3,2,1] 0 }
    -- output { 0 }
    
    let main (a: []i32) (i: i32): i32 =
      a[i]
    is the test i'mtesting the syntax on
    Troels Henriksen
    @athas
    So use one of the names #0 ("[4i32, 3i32, 2i32, 1i32] 1i32") or #1 ("[4i32, 3i32, 2i32, 1i32] 0i32").
    Orestis
    @omhepia:matrix.org
    [m]
    oh. then I must know the entire dataset to get it?
    Troels Henriksen
    @athas
    Since it permits unambiguous prefixes, just #0 and #1 will work here.
    Orestis
    @omhepia:matrix.org
    [m]
    I mustbe doing something very stupid i guess:
    futhark dataget test.fut #0
    Junk argument: test.fut
    Usage: futhark dataget program dataset
    Options:
    
      -V  --version  Print version information and exit.
      -h  --help     Print help and exit.
    Troels Henriksen
    @athas
    You need to quote the # or your shell will treat it as a comment.
    Orestis
    @omhepia:matrix.org
    [m]
    ok
    thanks sorry
    a last question if there are many tests all dataset have the same identifier. is there a way to distinguish them?
    Troels Henriksen
    @athas
    They won't have the same identifier.
    Well.. I guess if you have multiple datasets that are all just the same file. But then they would be identical anyway.
    Orestis
    @omhepia:matrix.org
    [m]
    if i have two tests say entry test1 and test2 with their own input
    then both have #0 as id
    Available datasets:
      #0 ("[4i32, 3i32, 2i32, 1i32] 1i32")
      #0 ("[4i32, 3i32, 2i32, 1i32] 2i32")
    Troels Henriksen
    @athas
    Oh, I guess futhark dataget is unable to cope with multiple entry points intelligently. In this case you'd need to provide the full dataset name.
    Orestis
    @omhepia:matrix.org
    [m]
    ok thanks!
    Orestis
    @omhepia:matrix.org
    [m]
    hello. I have a question. I played a bit with futhark autotune. it generated a .tuning file. how can I use the .tuning file within a program that is compiled from a futhark library?
    Troels Henriksen
    @athas
    That's sadly not fully automatic yet. You need to extract the sizes and then use the futhark_context_config_set_size() function. The compiler itself uses this utility function: https://github.com/diku-dk/futhark/blob/master/rts/c/tuning.h
    I've been meaning to make the tuning/library-integration smoother, but haven't gotten around to it yet (because we didn't have any libraries that benefited from tuning).
    Orestis
    @omhepia:matrix.org
    [m]
    ok thanks. I got a speedup of like a factor 3-4 on futhark bench and was wondering how well it would perform on the "real" case.
    Troels Henriksen
    @athas
    That's good! The speedup should be the same for the library (assuming the benchmark dataset is representative), as it's the same code.
    Orestis
    @omhepia:matrix.org
    [m]
    yes!