Skip to content

Commit

Permalink
Merge branch 'master' into scheduler
Browse files Browse the repository at this point in the history
Conflicts:
	.gitignore
	src/dist_tensor/cyclopstf.hpp
  • Loading branch information
solomonik committed Dec 17, 2013
2 parents 05b31ed + 7ec5d39 commit 9a63209
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 25 deletions.
9 changes: 9 additions & 0 deletions .gitignore
@@ -1,2 +1,11 @@
*.o
.*
# Build directories
*.o
.deps
bin/
lib/

# Autogenerated in first invocation of make
config.mk
src/make/make.in
52 changes: 29 additions & 23 deletions src/dist_tensor/cyclopstf.hpp
Expand Up @@ -58,6 +58,12 @@ struct tkv_pair {
bool operator< (const tkv_pair<dtype>& other) const{
return k < other.k;
}
bool operator==(const tkv_pair<dtype>& other) const{
return (k == other.k && d == other.d);
}
bool operator!=(const tkv_pair<dtype>& other) const{
return !(*this == other);
}
};

typedef tkv_pair<double> kv_pair;
Expand All @@ -83,7 +89,7 @@ inline bool comp_tkv_pair(tkv_pair<dtype> i,tkv_pair<dtype> j) {
#define PERFORM_DESYM 1
#define ALLOW_NVIRT 32
#define DIAG_RESCALE
#define USE_SYM_SUM
#define USE_SYM_SUM
#define HOME_CONTRACT
#define USE_BLOCK_RESHUFFLE

Expand Down Expand Up @@ -126,7 +132,7 @@ struct fseq_tsr_scl {
/* custom element-wise function for tensor scale */
template<typename dtype>
struct fseq_elm_scl {
void (*func_ptr)(dtype const alpha,
void (*func_ptr)(dtype const alpha,
dtype & a);
};

Expand All @@ -152,7 +158,7 @@ struct fseq_tsr_sum {
/* custom element-wise function for tensor sum */
template<typename dtype>
struct fseq_elm_sum {
void (*func_ptr)(dtype const alpha,
void (*func_ptr)(dtype const alpha,
dtype const a,
dtype & b);
};
Expand Down Expand Up @@ -187,8 +193,8 @@ struct fseq_tsr_ctr {
/* custom element-wise function for tensor sum */
template<typename dtype>
struct fseq_elm_ctr {
void (*func_ptr)(dtype const alpha,
dtype const a,
void (*func_ptr)(dtype const alpha,
dtype const a,
dtype const b,
dtype & c);
};
Expand Down Expand Up @@ -231,10 +237,10 @@ class tCTF{

/* return MPI_Comm global_context */
MPI_Comm get_MPI_Comm();

/* return MPI processor rank */
int get_rank();

/* return number of MPI processes in the defined global context */
int get_num_pes();

Expand All @@ -259,13 +265,13 @@ class tCTF{

/* set the tensor name */
int set_name(int const tensor_id, char const * name);

/* get the tensor name */
int get_name(int const tensor_id, char const ** name);

/* turn on profiling */
int profile_on(int const tensor_id);

/* turn off profiling */
int profile_off(int const tensor_id);

Expand All @@ -286,9 +292,9 @@ class tCTF{
int write_tensor(int const tensor_id,
long_int const num_pair,
tkv_pair<dtype> const * mapped_data);

/* Add tensor data new=alpha*new+beta*old
with <key, value> pairs where key is the
with <key, value> pairs where key is the
global index for the value. */
int write_tensor(int const tensor_id,
long_int const num_pair,
Expand All @@ -310,6 +316,7 @@ class tCTF{
dtype const beta,
tCTF<dtype> * tC_B);

<<<<<<< HEAD
/**
* \brief accumulates this tensor to a tensor object defined on a different world
* \param[in] tid id of tensor on this CTF instance
Expand Down Expand Up @@ -360,7 +367,7 @@ class tCTF{
int const * offsets_B,
int const * ends_B,
dtype const beta);

/* Same as above, except tid_B lives on dt_other_B */
int slice_tensor(int const tid_A,
int const * offsets_A,
Expand All @@ -371,9 +378,9 @@ class tCTF{
int const * ends_B,
dtype const beta,
tCTF<dtype> * dt_other_B);


/* read a block from tensor_id,

/* read a block from tensor_id,
new_tensor_id = tensor_id[offsets:ends] */
/* int read_block_tensor(int const tensor_id,
int const * offsets,
Expand All @@ -382,14 +389,14 @@ class tCTF{


/* read tensor data with <key, value> pairs where key is the
global index for the value, which gets filled in with
global index for the value, which gets filled in with
beta times the old values plus alpha times the values read from the tensor. */
int read_tensor(int const tensor_id,
long_int const num_pair,
dtype const alpha,
dtype const beta,
tkv_pair<dtype> * const mapped_data);

/* read tensor data with <key, value> pairs where key is the
global index for the value, which gets filled in. */
int read_tensor(int const tensor_id,
Expand All @@ -403,7 +410,7 @@ class tCTF{
long_int * num_pair,
dtype ** all_data);

/* read entire tensor with each processor to preallocated buffer
/* read entire tensor with each processor to preallocated buffer
(in packed layout).
WARNING: will use a lot of memory. */
int allread_tensor(int const tensor_id,
Expand Down Expand Up @@ -432,7 +439,7 @@ class tCTF{
dtype const alpha,
dtype const beta,
int const map_inner = 0);

/* contracts tensors alpha*A*B + beta*C -> C,
seq_func used to perform element-wise sequential op */
int contract(CTF_ctr_type_t const * type,
Expand Down Expand Up @@ -464,7 +471,7 @@ class tCTF{
dtype const alpha,
dtype const beta,
fseq_tsr_sum<dtype> const func_ptr);

/* DAXPY: a*idx_map_A(A) + b*idx_map_B(B) -> idx_map_B(B). */
int sum_tensors(dtype const alpha,
dtype const beta,
Expand All @@ -490,13 +497,14 @@ class tCTF{
int const tid,
int const * idx_map_A,
fseq_tsr_scl<dtype> const func_ptr);

/* scale tensor by alpha. A <- a*A */
int scale_tensor(dtype const alpha,
int const tid,
int const * idx_map_A,
fseq_elm_scl<dtype> const felm);

<<<<<<< HEAD
/**
* \brief estimate the cost of a contraction C[idx_C] = A[idx_A]*B[idx_B]
* \param[in] A first operand tensor
Expand Down Expand Up @@ -528,10 +536,8 @@ class tCTF{
int const * idx_B);




/* aligns tensor mapping of tid_A to that of tid_B */
int align(int const tid_A,
int align(int const tid_A,
int const tid_B);

/* product will contain the dot prodiuct if tsr_A and tsr_B */
Expand Down
4 changes: 2 additions & 2 deletions src/dist_tensor/dt_aux_topo.hxx
Expand Up @@ -62,8 +62,8 @@ void fold_torus(topology * topo,
/* Reorder the lda, bring j lda to lower lda and adjust other ldas */
color = glb_comm->rank - topo->dim_comm[i]->rank*topo->lda[i]
- topo->dim_comm[j]->rank*topo->lda[j];
if (j<ndim-1)
color = (color%topo->lda[i])+(color/topo->lda[j+1]);
// if (j<ndim-1)
// color = (color%topo->lda[i])+(color/topo->lda[j+1]);
}
np = topo->dim_comm[i]->np*topo->dim_comm[j]->np;

Expand Down

0 comments on commit 9a63209

Please sign in to comment.