Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Function: fromfile Line: 78 Error: error occured while reading the fileterminate called after throwing an instance of 'std::invalid_argument #219

Closed
DyzGoGoGo opened this issue Dec 18, 2024 · 1 comment

Comments

@DyzGoGoGo
Copy link

I am currently using NumCpp to read bin files exported from numpy. There is no issue when the file size is below 2GB, but when the file size exceeds 2GB, nc::load throws an error.

python:

import numpy as np

a = np.zeros((32,18000000),dtype=np.float32)
a.tofile('pred_np.bin')

cpp:

#include "NumCpp.hpp"

#include <cstdlib>
#include <iostream>
#include <string>
using namespace std;

int main() {
    std::string inFilename = "F:\\MNEProject\\eigen\\data_file\\pred_np.bin";

    auto a = nc::load<float>(inFilename);

    return EXIT_SUCCESS;
}

error:

File: E:/CppLibrary/NumCpp/include/NumCpp/Functions/fromfile.hpp
        Function: fromfile
        Line: 78
        Error: error occured while reading the fileterminate called after throwing an instance of 'std::invalid_argument
'
  what():  File: E:/CppLibrary/NumCpp/include/NumCpp/Functions/fromfile.hpp
        Function: fromfile
        Line: 78
        Error: error occured while reading the file
dpilger26 added a commit that referenced this issue Jan 3, 2025
* starting rc2.13.0 branch

* attempting to fix actions

* attempting to fix actions

* fixed a typo from last commit

* attempting to fix actions

* attempting to fix actions

* attempting to fix actions

* attempting to fix actions

* attempting to fix actions

* attempting to fix actions

* attempting to fix actions

* attempting to fix actions

* attempting to fix actions

* attempting to fix actions

* attempting to fix actions

* attempting to fix actions

* attempting to fix actions

* attempting to fix actions

* attempting to fix actions

* attempting to fix actions

* attempting to fix actions

* attempting to fix actions

* attempting to fix actions

* attempting to fix actions

* attempting to fix actions

* attempting to fix actions

* made random generator inline

* fixed filesize error in fromfile in support of Issue #219

* updated clang version for actions

* tweaking actions

* updated docs, still fidling with actions

* reverting back to clang18 for actions

---------

Co-authored-by: = <=>
@dpilger26
Copy link
Owner

Fixed in Version 2.13 release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants