*** empty log message ***
This commit is contained in:
parent
7fd5c953ff
commit
195474b5f5
10
la_traits.h
10
la_traits.h
@ -223,10 +223,11 @@ static inline void put(int fd, const complex<C> &x, bool dimensions=0, bool tran
|
|||||||
static void multiget(size_t n,int fd, complex<C> *x, bool dimensions=0)
|
static void multiget(size_t n,int fd, complex<C> *x, bool dimensions=0)
|
||||||
{
|
{
|
||||||
size_t total=0;
|
size_t total=0;
|
||||||
|
size_t system_limit = (1L<<30)/sizeof(complex<C>); //read at most 1GB at once
|
||||||
ssize_t r;
|
ssize_t r;
|
||||||
do{
|
do{
|
||||||
r=read(fd,x+total,(n-total)*sizeof(complex<C>));
|
r=read(fd,x+total,(n-total > system_limit ? system_limit : n-total)*sizeof(complex<C>));
|
||||||
if(r<0 || r==0 && n!=0 ) {std::cout<<"read returned "<<r<<std::endl; laerror("read error");}
|
if(r<0 || r==0 && n!=0 ) {std::cout<<"read returned "<<r<<" perror "<<strerror(errno) <<std::endl; laerror("read error");}
|
||||||
else total += r/sizeof(complex<C>);
|
else total += r/sizeof(complex<C>);
|
||||||
if(r%sizeof(complex<C>)) laerror("read error 2");
|
if(r%sizeof(complex<C>)) laerror("read error 2");
|
||||||
}
|
}
|
||||||
@ -235,10 +236,11 @@ static void multiget(size_t n,int fd, complex<C> *x, bool dimensions=0)
|
|||||||
static void multiput(size_t n, int fd, const complex<C> *x, bool dimensions=0)
|
static void multiput(size_t n, int fd, const complex<C> *x, bool dimensions=0)
|
||||||
{
|
{
|
||||||
size_t total=0;
|
size_t total=0;
|
||||||
|
size_t system_limit = (1L<<30)/sizeof(complex<C>); //read at most 1GB at once
|
||||||
ssize_t r;
|
ssize_t r;
|
||||||
do{
|
do{
|
||||||
r=write(fd,x+total,(n-total)*sizeof(complex<C>));
|
r=write(fd,x+total,(n-total > system_limit ? system_limit : n-total)*sizeof(complex<C>));
|
||||||
if(r<0 || r==0 && n!=0 ) {std::cout<<"write returned "<<r<<std::endl; laerror("write error");}
|
if(r<0 || r==0 && n!=0 ) {std::cout<<"write returned "<<r<<" perror "<<strerror(errno) <<std::endl; laerror("write error");}
|
||||||
else total += r/sizeof(complex<C>);
|
else total += r/sizeof(complex<C>);
|
||||||
if(r%sizeof(complex<C>)) laerror("write error 2");
|
if(r%sizeof(complex<C>)) laerror("write error 2");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user