MPQC 2.3.1

- Main Page
- Related Pages
- Classes
- Files

- File List

memrdma.h

    00001 //
    00002 // memrdma.h
    00003 // Based on memamsg.h
    00004 //
    00005 // Copyright (C) 1996 Limit Point Systems, Inc.
    00006 //
    00007 // Author: Curtis Janssen <cljanss@limitpt.com>
    00008 // Maintainer: LPS
    00009 //
    00010 // This file is part of the SC Toolkit.
    00011 //
    00012 // The SC Toolkit is free software; you can redistribute it and/or modify
    00013 // it under the terms of the GNU Library General Public License as published by
    00014 // the Free Software Foundation; either version 2, or (at your option)
    00015 // any later version.
    00016 //
    00017 // The SC Toolkit is distributed in the hope that it will be useful,
    00018 // but WITHOUT ANY WARRANTY; without even the implied warranty of
    00019 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    00020 // GNU Library General Public License for more details.
    00021 //
    00022 // You should have received a copy of the GNU Library General Public License
    00023 // along with the SC Toolkit; see the file COPYING.LIB.  If not, write to
    00024 // the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
    00025 //
    00026 // The U.S. Government is granted a limited license as per AL 91-7.
    00027 //
    00028
    00029 #ifdef __GNUC__
    00030 #pragma interface
    00031 #endif
    00032
    00033 #ifndef _util_group_memrdma_h
    00034 #define _util_group_memrdma_h
    00035
    00036 #include <iostream>
    00037 #include <vector>
    00038
    00039 #include <util/group/pool.h>
    00040 #include <util/group/memmsg.h>
    00041
    00042 namespace sc {
    00043
    00046 class RDMAMemoryGrp : public MsgMemoryGrp {
    00047   protected:
    00048     char *data_;
    00049
    00050     virtual void retrieve_data(void *, int node, int offset, int size,
    00051                                int lock) = 0;
    00052     virtual void replace_data(void *, int node, int offset, int size,
    00053                               int unlock) = 0;
    00054     virtual void sum_data(double *data, int node, int doffset, int dsize) = 0;
    00055
    00056     std::vector<Pool*> pools_;
    00057     size_t default_pool_size_;
    00058     void* malloc_region(size_t nbyte);
    00059     void free_region(void*);
    00060   public:
    00061     RDMAMemoryGrp(const Ref<MessageGrp>& msg);
    00062     RDMAMemoryGrp(const Ref<KeyVal>&);
    00063     ~RDMAMemoryGrp();
    00064
    00065     void *localdata();
    00066
    00067     void set_localsize(size_t localsize);
    00068
    00069     void *obtain_writeonly(distsize_t offset, int size);
    00070     void *obtain_readwrite(distsize_t offset, int size);
    00071     void *obtain_readonly(distsize_t offset, int size);
    00072     void release_readonly(void *data, distsize_t offset, int size);
    00073     void release_writeonly(void *data, distsize_t offset, int size);
    00074     void release_readwrite(void *data, distsize_t offset, int size);
    00075
    00076     void sum_reduction(double *data, distsize_t doffset, int dsize);
    00077     void sum_reduction_on_node(double *data, size_t doffset, int dsize,
    00078                                int node = -1);
    00079
    00080     void print(std::ostream &o = ExEnv::out0()) const;
    00081 };
    00082
    00083 }
    00084
    00085 #endif
    00086
    00087 // Local Variables:
    00088 // mode: c++
    00089 // c-file-style: "CLJ"
    00090 // End: