diff --git a/ippl/src/Field/LField.hpp b/ippl/src/Field/LField.hpp index 5bfa534aa370e9c58604c8dd9dbc1794f907a101..f1b695578f0d6c09d523bedd3b582d2b51d469d9 100644 --- a/ippl/src/Field/LField.hpp +++ b/ippl/src/Field/LField.hpp @@ -725,11 +725,7 @@ LField<T,Dim>::allocateStorage(int newsize) // Allocate the storage, creating some extra to account for offset, and // then add in the offset. -#ifdef IPPL_DIRECTIO - P = (T *)valloc(sizeof(T) * (newsize + extra)); -#else - P = new T[newsize + extra]; -#endif + P = new T[newsize + extra]; P += extra; ADDIPPLSTAT(incLFieldBytes, (newsize+extra)*sizeof(T)); @@ -754,15 +750,7 @@ LField<T,Dim>::deallocateStorage() if (IpplInfo::offsetStorage) P -= (offsetBlocks*IPPL_CACHE_LINE_SIZE / sizeof(T)); - // Free the storage - -#ifdef IPPL_DIRECTIO - free(P); -#else delete [] P; -#endif - // Reset our own pointer to zero - P = 0; } } @@ -788,4 +776,4 @@ void LField<T,Dim>::write(std::ostream& out) const * $RCSfile: LField.cpp,v $ $Author: adelmann $ * $Revision: 1.1.1.1 $ $Date: 2003/01/23 07:40:26 $ * IPPL_VERSION_ID: $Id: LField.cpp,v 1.1.1.1 2003/01/23 07:40:26 adelmann Exp $ - ***************************************************************************/ \ No newline at end of file + ***************************************************************************/ diff --git a/ippl/src/Utility/DiscBuffer.cpp b/ippl/src/Utility/DiscBuffer.cpp index 2edfd6f5f5bc5789363be19a9600859413df682a..45cef300f0ce77ee68c53265f4e5abdbb3d10969 100644 --- a/ippl/src/Utility/DiscBuffer.cpp +++ b/ippl/src/Utility/DiscBuffer.cpp @@ -64,11 +64,7 @@ DiscBuffer::DiscBuffer() DiscBuffer::~DiscBuffer() { if (buffer_s != 0) -#ifdef IPPL_DIRECTIO - free(buffer_s); -#else delete [] buffer_s; -#endif size_s = 0; buffer_s = 0; @@ -87,27 +83,15 @@ void *DiscBuffer::resize(long sz) if (sz > size_s) { // Reset our existing size - size_s = sz; // Free the old buffer, if necessary, and create a new one - -#ifdef IPPL_DIRECTIO - if (buffer_s != 0) - { - free(buffer_s); - buffer_s = 0; - } - buffer_s = (char *)valloc(size_s); -#else if (buffer_s != 0) { delete [] buffer_s; buffer_s = 0; } buffer_s = new char[size_s]; -#endif - PAssert(buffer_s); } @@ -126,4 +110,4 @@ DiscBuffer ipplGlobalDiscBuffer_g; * $RCSfile: DiscBuffer.cpp,v $ $Author: adelmann $ * $Revision: 1.1.1.1 $ $Date: 2003/01/23 07:40:33 $ * IPPL_VERSION_ID: $Id: DiscBuffer.cpp,v 1.1.1.1 2003/01/23 07:40:33 adelmann Exp $ - ***************************************************************************/ \ No newline at end of file + ***************************************************************************/ diff --git a/ippl/src/Utility/DiscField.h b/ippl/src/Utility/DiscField.h index 7fc50acbe2d8bfe81bb9a2a4a9906ee84afeeab2..f2a6e81ba1db8567500f4c301a26ba90aa8cbd84 100644 --- a/ippl/src/Utility/DiscField.h +++ b/ippl/src/Utility/DiscField.h @@ -403,14 +403,6 @@ public: // this a little bigger to match the device block size. long nbytes = maxsize*sizeof(T); -#ifdef IPPL_DIRECTIO - if (openedDirectIO) { - nbytes += dioinfo.d_miniosz; // extra in case offset is wrong - size_t ndiff = nbytes % dioinfo.d_miniosz; - if (ndiff > 0) - nbytes += (dioinfo.d_miniosz - ndiff); - } -#endif buffer = static_cast<T *>(DiscBuffer::resize(nbytes)); DFDBG(dbgmsg << "On box0: resized buf to " << DiscBuffer::size()); DFDBG(dbgmsg << " bytes ... current block will need "); @@ -426,44 +418,6 @@ public: // seekpos now. Add in the extra amount we'll be reading. seekpos += readbytes; -#ifdef IPPL_DIRECTIO - // If we're doing direct-io, we will need to adjust the start - // and end of our buffers and offsets ... - if (openedDirectIO) { - // Find out how much our offset is off from multipple of - // block size, and move it back by the difference. Then we - // will read in extra data and our storage will be offset to - // start at the place where the new data is actually located. - - PAssert_GE(readoffset, 0); - Offset_t extra = readoffset % dioinfo.d_miniosz; - readoffset -= extra; - DFDBG(dbgmsg << "DIO: Moving read offset back by " << extra); - DFDBG(dbgmsg << " bytes, to readoffset = " << readoffset<<endl); - - // Compute the number of elements to read. We might also need - // to extend the read size to get the total read size to be a - // multipple of the device block size. - - readbytes += extra; - size_t ndiff = readbytes % dioinfo.d_miniosz; - if (ndiff > 0) - readbytes += (dioinfo.d_miniosz - ndiff); - PAssert_GE(nbytes, readbytes); - DFDBG(dbgmsg << "DIO: Adjusted readbytes from "); - DFDBG(dbgmsg << (nelems * sizeof(T)) << " to " << readbytes); - DFDBG(dbgmsg << endl); - - // Point the buffer at the real first element, adjusted to - // counteract our moving the offset location back to a - // block-size multipple. - PAssert_EQ(extra % sizeof(T), 0); - buffer += (extra / sizeof(T)); - DFDBG(dbgmsg << "DIO: Adjusted buffer pointer forward "); - DFDBG(dbgmsg << (extra / sizeof(T)) << " elements." << endl); - } -#endif - // Read data in a way that might do direct-io DFDBG(dbgmsg << "Calling read_data with readbytes=" << readbytes); DFDBG(dbgmsg << ", readoffset=" << readoffset << endl); @@ -1072,12 +1026,6 @@ private: // key: local NDIndex, value: node GlobalIDList_t globalID; - // Direct-IO info, required if we are using the DIRECTIO option -#ifdef IPPL_DIRECTIO - struct dioattr dioinfo; - bool openedDirectIO; -#endif - // // functions used to build/query information about the processors, etc. // @@ -1237,19 +1185,6 @@ private: long elems = owned.size(); long chunkbytes = Ippl::chunkSize(); -#ifdef IPPL_DIRECTIO - if (openedDirectIO) { - // For direct-io, make sure we write out blocks with size that is - // a multipple of the minimum io size - PAssert_EQ(dioinfo.d_miniosz % sizeof(T), 0); - if (chunkbytes == 0 || chunkbytes > dioinfo.d_maxiosz) - chunkbytes = dioinfo.d_maxiosz; - else if (chunkbytes < dioinfo.d_miniosz) - chunkbytes = dioinfo.d_miniosz; - else if (chunkbytes % dioinfo.d_miniosz > 0) - chunkbytes -= (chunkbytes % dioinfo.d_miniosz); - } -#endif long chunksize = chunkbytes / sizeof(T); if (chunksize < 1 || chunksize > elems) chunksize = elems; @@ -1286,13 +1221,6 @@ private: // where data must be written out in blocks with sizes that // match the device block size. size_t nbytes = amount*sizeof(T); -#ifdef IPPL_DIRECTIO - if (openedDirectIO) { - size_t ndiff = nbytes % dioinfo.d_miniosz; - if (ndiff > 0) - nbytes += (dioinfo.d_miniosz - ndiff); - } -#endif DFDBG(dbgmsg << " Will write total nbytes = " << nbytes); DFDBG(dbgmsg << ", this has extra " << (nbytes - amount*sizeof(T))); DFDBG(dbgmsg << " bytes." << endl); @@ -1325,9 +1253,6 @@ private: wtimer.clear(); wtimer.start(); -#ifdef IPPL_DIRECTIO - size_t nout = ::pwrite(outputDatafd, buffer, nbytes, seekoffset); -#else size_t nout = 0; if (::lseek(outputDatafd, seekoffset, SEEK_SET) == seekoffset) { char *wbuf = (char *)buffer; @@ -1335,7 +1260,6 @@ private: } else { seekok = false; } - #endif wtimer.stop(); DiscBuffer::writetime += wtimer.clock_time(); @@ -1647,13 +1571,6 @@ private: PAssert_GE(outputDatafd, 0); PAssert_EQ(readsize % sizeof(T), 0); -#ifdef IPPL_DIRECTIO - if (openedDirectIO) { - PAssert_EQ(readsize % dioinfo.d_miniosz, 0); - PAssert_EQ(seekpos % dioinfo.d_miniosz, 0); - } -#endif - // Now read the block of data off_t seekoffset = seekpos; size_t nbytes = readsize; @@ -1663,9 +1580,6 @@ private: rtimer.clear(); rtimer.start(); -#ifdef IPPL_DIRECTIO - size_t nout = ::pread(outputDatafd, buffer, nbytes, seekoffset); -#else size_t nout = 0; if (::lseek(outputDatafd, seekoffset, SEEK_SET) == seekoffset) { char *rbuf = (char *)buffer; @@ -1673,7 +1587,6 @@ private: } else { seekok = false; } -#endif rtimer.stop(); DiscBuffer::readtime += rtimer.clock_time(); diff --git a/ippl/src/Utility/DiscField.hpp b/ippl/src/Utility/DiscField.hpp index e2794395f3be5edc4e71f77c6b9e53a942baa8bd..50d38979845927eb179129fb02f635397507f756 100644 --- a/ippl/src/Utility/DiscField.hpp +++ b/ippl/src/Utility/DiscField.hpp @@ -113,10 +113,6 @@ void DiscField<Dim>::initialize(const char *base, const char *config, NumVnodes = 0; VnodeTally = 0; -#ifdef IPPL_DIRECTIO - openedDirectIO = false; -#endif - // save the number of fields, which indicates if this object is being // opened for reading or writing NumFields = numFields; @@ -210,52 +206,14 @@ int DiscField<Dim>::open_df_file_fd(const std::string& fnm, const std::string& s // Form the open flags int flags = origflags; -#ifdef IPPL_DIRECTIO - openedDirectIO = false; - if (IpplInfo::useDirectIO) { - flags |= O_DIRECT; - openedDirectIO = true; - } -#endif // Try to open the file int f = ::open(fnamebuf.c_str(), flags, 0644); if (f < 0) { - // If we tried with direct-io but failed, see if we can dothis without dio -#ifdef IPPL_DIRECTIO - f = ::open(fnamebuf.c_str(), origflags, 0644); - openedDirectIO = (f >= 0); -#endif - - // If that still did not work, we're screwed - if (f < 0) { - ERRORMSG("DiscField: Could not open file '" << fnamebuf.c_str()); - ERRORMSG("' on node " << Ippl::myNode() << ", f = " << f << "."<<endl); - return (-1); - } - } - - // Get direct-io info, if necessary - -#ifdef IPPL_DIRECTIO - if (openedDirectIO) { - if (::fcntl(f, F_DIOINFO, &dioinfo) != 0) { - ERRORMSG("DiscField: Could not get dio info for '"<< fnamebuf.c_str()); - ERRORMSG("' using direct io on node "); - ERRORMSG(Ippl::myNode() << "." << endl); - close(f); - return (-1); - } - - DFDBG(std::string dbgmsgname("DF:open_df_file_fd")); - DFDBG(Inform dbgmsg(dbgmsgname.c_str(), INFORM_ALL_NODES)); - DFDBG(dbgmsg << "Opened file '" << fnamebuf.c_str() << "' with direct-io"); - DFDBG(dbgmsg << ", dioinfo = (miniosz="<<dioinfo.d_miniosz<<", maxiosz="); - DFDBG(dbgmsg << dioinfo.d_maxiosz << ", mem=" << dioinfo.d_mem << ")"); - DFDBG(dbgmsg << endl); + ERRORMSG("DiscField: Could not open file '" << fnamebuf.c_str()); + ERRORMSG("' on node " << Ippl::myNode() << ", f = " << f << "."<<endl); + return (-1); } -#endif - return f; } diff --git a/ippl/src/Utility/IpplInfo.cpp b/ippl/src/Utility/IpplInfo.cpp index f29c529adc8175a3a95968a4fb6da28e0bf326d1..d119f5db6b9d21cf05bbc815b26c845d1156b4a1 100644 --- a/ippl/src/Utility/IpplInfo.cpp +++ b/ippl/src/Utility/IpplInfo.cpp @@ -496,12 +496,8 @@ IpplInfo::IpplInfo(int& argc, char**& argv, int removeargs, MPI_Comm mpicomm) { } else if ( ( strcmp(argv[i], "--directio") == 0 ) ) { // Turn on the use of Direct-IO, if possible -#ifdef IPPL_DIRECTIO - useDirectIO = true; -#else param_error(argv[i], "Direct-IO is not available in this build of IPPL", 0); -#endif } else if ( ( strcmp(argv[i], "--maxfftnodes") == 0 ) ) { // Limit the number of nodes that can participate in FFT operations if ( (i + 1) < argc && argv[i+1][0] != '-' && atoi(argv[i+1]) > 0 ) @@ -857,9 +853,6 @@ void IpplInfo::printHelp(char** argv) { INFOMSG(" --chunksize <n> : Set I/O chunk size. Can end w/K,M,G.\n"); INFOMSG(" --persmppario : Enable on-SMP parallel IO option.\n"); INFOMSG(" --nopersmppario : Disable on-SMP parallel IO option (default).\n"); -#ifdef IPPL_DIRECTIO - INFOMSG(" --directio : Use Direct-IO if possible.\n"); -#endif } ///////////////////////////////////////////////////////////////////// @@ -1084,7 +1077,6 @@ void IpplInfo::stash() { obj.noFieldCompression = noFieldCompression; obj.offsetStorage = offsetStorage; obj.extraCompressChecks = extraCompressChecks; - obj.useDirectIO = useDirectIO; obj.communicator_m = communicator_m; obj.NumCreated = NumCreated; obj.CommInitialized = CommInitialized; @@ -1116,7 +1108,6 @@ void IpplInfo::stash() { noFieldCompression = false; offsetStorage = false; extraCompressChecks = false; - useDirectIO = false; communicator_m = MPI_COMM_WORLD; NumCreated = 0; CommInitialized = false; @@ -1163,7 +1154,6 @@ void IpplInfo::pop() { noFieldCompression = obj.noFieldCompression; offsetStorage = obj.offsetStorage; extraCompressChecks = obj.extraCompressChecks; - useDirectIO = obj.useDirectIO; communicator_m = obj.communicator_m; NumCreated = obj.NumCreated; CommInitialized = obj.CommInitialized; diff --git a/ippl/src/Utility/IpplInfo.h b/ippl/src/Utility/IpplInfo.h index 97a535449b868eb38f3d5d2b632398950f27f7c8..2f37b837f64da6ecbd6e3a163c3c91478d62da02 100644 --- a/ippl/src/Utility/IpplInfo.h +++ b/ippl/src/Utility/IpplInfo.h @@ -298,11 +298,6 @@ public: // individual LField has been processed in an expression. static bool extraCompressChecks; - // Static flag telling whether to try to use direct-io. This is only - // possible if the library is compiled with the IPPL_DIRECTIO option, - // and you are on a system that provides this capablity. - static bool useDirectIO; - // Static routine giving one a place to stop at with #$%$%#1 stupid // debuggers. static void here(); diff --git a/ippl/src/Utility/StaticIpplInfo.h b/ippl/src/Utility/StaticIpplInfo.h index c7b5c5abcfb5eea01af0e3a69a3d1864e1f28929..214e39093133f18e0cc94234b500a60e06d9b392 100644 --- a/ippl/src/Utility/StaticIpplInfo.h +++ b/ippl/src/Utility/StaticIpplInfo.h @@ -51,11 +51,6 @@ public: // individual LField has been processed in an expression. bool extraCompressChecks; - // flag telling whether to try to use direct-io. This is only - // possible if the library is compiled with the IPPL_DIRECTIO option, - // and you are on a system that provides this capablity. - bool useDirectIO; - MPI_Comm communicator_m; // counter indicating how many IpplInit objects have been created.