changeset 11:33dd14a7f49d

deprecated the default branch -- still have to make MC_shared and Pure_C brchs
author Some Random Person <seanhalle@yahoo.com>
date Thu, 24 May 2012 09:58:57 -0700
parents 79982974d355
children
files .hgeol ListOfArrays.c ListOfArrays.h __brch__DEPRECATED_README
diffstat 4 files changed, 22 insertions(+), 125 deletions(-) [+]
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/.hgeol	Thu May 24 09:58:57 2012 -0700
     1.3 @@ -0,0 +1,14 @@
     1.4 +
     1.5 +[patterns]
     1.6 +**.py = native
     1.7 +**.txt = native
     1.8 +**.c = native
     1.9 +**.h = native
    1.10 +**.cpp = native
    1.11 +**.java = native
    1.12 +**.class = bin
    1.13 +**.jar = bin
    1.14 +**.sh = native
    1.15 +**.pl = native
    1.16 +**.jpg = bin
    1.17 +**.gif = bin
     2.1 --- a/ListOfArrays.c	Thu Mar 08 19:05:26 2012 +0100
     2.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.3 @@ -1,61 +0,0 @@
     2.4 -
     2.5 -#include "ListOfArrays.h"
     2.6 -#include "../../VMS_Implementations/VMS_impl/vmalloc.h"
     2.7 -
     2.8 -ListOfArrays* makeListOfArrays(size_t entry_size, int num_entries_per_block){
     2.9 -    ListOfArrays* newLoA = (ListOfArrays*) VMS__malloc(sizeof(ListOfArrays));
    2.10 -    newLoA->dim1info = makePrivDynArrayOfSize(&(newLoA->dim1),8);
    2.11 -       
    2.12 -    newLoA->entry_size = entry_size;
    2.13 -    newLoA->num_entries_per_fragment = num_entries_per_block;
    2.14 -    newLoA->next_free_index = 0;
    2.15 -    
    2.16 -    return newLoA;
    2.17 -}
    2.18 -
    2.19 -void forAllInListOfArraysDo(ListOfArrays* list, ListOfArraysFnPtr fnPtr){
    2.20 -    int n;
    2.21 -    uintptr_t p;
    2.22 -    int num_full = list->next_free_index / list->num_entries_per_fragment; //list->dim1info->numInArray -1
    2.23 -    for(n=0;n<num_full; n++){
    2.24 -        for(p = (uintptr_t) (list->dim1)[n]; p < (uintptr_t) (list->dim1)[n] + list->num_entries_per_fragment * list->entry_size; p += list->entry_size){
    2.25 -            (*fnPtr)((void*)p);
    2.26 -        }
    2.27 -    }
    2.28 -    int offset_in_last = list->next_free_index % list->num_entries_per_fragment;
    2.29 -    n = list->dim1info->numInArray - 1;
    2.30 -    if (n >= 0){
    2.31 -        for(p = (uintptr_t)(list->dim1)[n]; p < (uintptr_t)(list->dim1)[n] + offset_in_last * list->entry_size; p += list->entry_size){
    2.32 -            (*fnPtr)((void*)p);
    2.33 -        }
    2.34 -    }
    2.35 -}
    2.36 -
    2.37 -void freeListOfArrays(ListOfArrays* list){
    2.38 -    freeDynArrayDeep(list->dim1info,&VMS__free);
    2.39 -    VMS__free((void*)list);
    2.40 -}
    2.41 -
    2.42 -/*
    2.43 -void addToListOfArraysDependency(Dependency value, ListOfArrays* list){
    2.44 -    int offset_in_fragment = list->next_free_index % list->num_entries_per_fragment; 
    2.45 -    if(offset_in_fragment == 0){ 
    2.46 -        void* newBlock = VMS__malloc(list->entry_size * list->num_entries_per_fragment); 
    2.47 -        addToDynArray(newBlock,list->dim1info); 
    2.48 -    } 
    2.49 -    Dependency* typedFragment = (Dependency*) ((list->dim1)[list->dim1info->numInArray -1]); 
    2.50 -    typedFragment[offset_in_fragment] = value; 
    2.51 -    list->next_free_index++; 
    2.52 -}
    2.53 -
    2.54 -void addToListOfArraysUnit(Unit value, ListOfArrays* list){
    2.55 -    int offset_in_fragment = list->next_free_index % list->num_entries_per_fragment; 
    2.56 -    if(offset_in_fragment == 0){ 
    2.57 -        void* newBlock = VMS__malloc(list->entry_size * list->num_entries_per_fragment); 
    2.58 -        addToDynArray(newBlock,list->dim1info); 
    2.59 -    } 
    2.60 -    Unit* typedFragment = (Unit*) ((list->dim1)[list->dim1info->numInArray -1]); 
    2.61 -    typedFragment[offset_in_fragment] = value; 
    2.62 -    list->next_free_index++; 
    2.63 -}
    2.64 - */
    2.65 \ No newline at end of file
     3.1 --- a/ListOfArrays.h	Thu Mar 08 19:05:26 2012 +0100
     3.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.3 @@ -1,64 +0,0 @@
     3.4 -/* 
     3.5 - * File:   ListOfArrays.h
     3.6 - * Author: Nina Engelhardt
     3.7 - *
     3.8 - * Created on December 16, 2011, 2:06 PM
     3.9 - */
    3.10 -
    3.11 -#ifndef LISTOFARRAYS_H
    3.12 -#define	LISTOFARRAYS_H
    3.13 -
    3.14 -#include<stddef.h>
    3.15 -#include "../DynArray/DynArray.h"
    3.16 -
    3.17 -
    3.18 -typedef struct {
    3.19 -    void* next;
    3.20 -    void* data;
    3.21 -} ArrayFragment;
    3.22 -
    3.23 -typedef struct {
    3.24 -    void** dim1;
    3.25 -    PrivDynArrayInfo* dim1info;
    3.26 -    //ArrayFragment* last;
    3.27 -    size_t entry_size;
    3.28 -    int num_entries_per_fragment;
    3.29 -    int next_free_index;
    3.30 -} ListOfArrays;
    3.31 -
    3.32 -ListOfArrays* makeListOfArrays(size_t entry_size, int num_entries_per_block);
    3.33 -
    3.34 -#define addToListOfArrays(type,value,list) do { \
    3.35 -    int offset_in_fragment = list->next_free_index % list->num_entries_per_fragment; \
    3.36 -    if(offset_in_fragment == 0){ \
    3.37 -        void* newBlock = VMS__malloc(list->entry_size * list->num_entries_per_fragment); \
    3.38 -        addToDynArray(newBlock,list->dim1info); \
    3.39 -    } \
    3.40 -    type* typedFragment = (type*) ((list->dim1)[list->dim1info->numInArray -1]); \
    3.41 -    typedFragment[offset_in_fragment] = value; \
    3.42 -    list->next_free_index++; \
    3.43 -} while (0)
    3.44 -
    3.45 -#define addToListOfArrays_ext(type,value,list) do { \
    3.46 -    int offset_in_fragment = list->next_free_index % list->num_entries_per_fragment; \
    3.47 -    if(offset_in_fragment == 0){ \
    3.48 -        void* newBlock = malloc(list->entry_size * list->num_entries_per_fragment); \
    3.49 -        addToDynArray(newBlock,list->dim1info); \
    3.50 -    } \
    3.51 -    type* typedFragment = (type*) ((list->dim1)[list->dim1info->numInArray -1]); \
    3.52 -    typedFragment[offset_in_fragment] = value; \
    3.53 -    list->next_free_index++; \
    3.54 -} while (0)
    3.55 -
    3.56 -typedef void  (*ListOfArraysFnPtr)  ( void * );  //fn has to cast void *
    3.57 -
    3.58 -void forAllInListOfArraysDo(ListOfArrays* list, ListOfArraysFnPtr fnPtr);
    3.59 -
    3.60 -#define valueInListOfArrays(type,index,list) ((type*)((list->dim1)[index / list->num_entries_per_fragment]))[index % list->num_entries_per_fragment]
    3.61 -
    3.62 -#define setValueInListOfArrays(type,index,value,list) ((type*)((list->dim1)[index / list->num_entries_per_fragment]))[index % list->num_entries_per_fragment] = value
    3.63 -
    3.64 -void freeListOfArrays(ListOfArrays* list);
    3.65 -
    3.66 -#endif	/* LISTOFARRAYS_H */
    3.67 -
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/__brch__DEPRECATED_README	Thu May 24 09:58:57 2012 -0700
     4.3 @@ -0,0 +1,8 @@
     4.4 +
     4.5 +There are two versions of the library -- one for pure C use, the other for use inside VMS or within applications written in a VMS-based language (IE, inside a top-level function or a call descendant of a top-level function) -- but only when the VMS is the "MC_shared" version.
     4.6 +
     4.7 +The reason is that VMS that uses shared memory on multicores moves the SlaveVPs around among cores.  But, the libC and glibC malloc stores info at the top of the stack (a "clever" hack), for a speed improvement.  So, when VMS manipulates the stack pointer, and/or moves Slaves to different cores, the "free" seg faults (that was FUN to figure out ; )  So, this version of VMS implements its own malloc.  
     4.8 +
     4.9 +It is anticipated that the MC_split version, where each core has separate data, and messages are sent between cores, can handle malloc and free to use the glibC version.
    4.10 +
    4.11 +For now, update to the version of the library you wish to use..