Giter VIP home page Giter VIP logo

Comments (2)

bhamon avatar bhamon commented on August 27, 2024 1

@k06a That's the purpose of the "direct" writing strategy.
See Program usage for information on how to use it (gpuPlotGenerator help generate).
See #18 for a windows optimized version. The pre-allocation part needs to be ported to linux and OSX now.

from gpuplotgenerator.

k06a avatar k06a commented on August 27, 2024

This code works fine for macOS and linux:

    unsigned long long file_size = ((unsigned long long) nonces) * PLOT_SIZE;
#ifdef HAVE_FALLOCATE
    printf("Using fallocate to expand file size to %lluGB\n", file_size/1024/1024/1024);
    ftruncate(ofd, 0);
    int ret = fallocate(ofd, FALLOC_FL_UNSHARE, 0, file_size);
    if (ret == -1) {
        printf("Failed to expand file to size %llu (errno %d - %s).\n", file_size, errno, strerror(errno));
        exit(-1);
    }
#elif defined(HAVE_POSIX_FALLOCATE)
    printf("Using posix_fallocate to expand file size to %lluGB\n", file_size/1024/1024/1024);
    ftruncate(ofd, 0);
    int ret = posix_fallocate(ofd, 0, file_size);
    if (ret == -1) {
        printf("Failed to expand file to size %llu (errno %d - %s).\n", file_size, errno, strerror(errno));
        exit(-1);
    }
#elif defined(__APPLE__)
    printf("Using fcntl::F_SETSIZE to expand file size to %lluGB\n", file_size/1024/1024/1024);
    unsigned long long result_size = file_size;
    int ret = fcntl(ofd, F_SETSIZE, &result_size);
      if(ret == -1) {
        printf("Failed set size %llu (errno %d - %s).\n", file_size, errno, strerror(errno));
        exit(-1);
    }
#else
    printf("Using ftruncate to expand file size to %lluGB\n", file_size/1024/1024/1024);
    ftruncate(ofd, file_size);
#endif

from gpuplotgenerator.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.