 		for(Ti = 0; Ti < T_size; Ti++){
 			T = T_list[Ti];
 
+			/* try to make a global vector of length T and then get size of local portion */
+			TRY( VecCreate(PETSC_COMM_WORLD,&layout) );
+			TRY( VecSetSizes(layout,PETSC_DECIDE,T) );
+			TRY( VecSetFromOptions(layout) );
+			/* get the ownership range - now I know how much I will calculate from the time-series */
+			TRY( VecGetLocalSize(layout,&Tlocal) );
+			TRY( VecDestroy(&layout) ); /* destroy testing vector - it is useless now */
+
+			/* create global vector */
+			#ifdef USE_CUDA
+				TRY( VecCreate(PETSC_COMM_WORLD, &x_global) );
+				TRY( VecSetSizes(x_global, K*Tlocal, PETSC_DETERMINE) );
+				TRY( VecSetType(x_global, VECMPICUDA) );
+				TRY( VecSetFromOptions(x_global) );
+				TRY( VecAssemblyBegin(x_global) );
+				TRY( VecAssemblyEnd(x_global) );
+			#else
+				TRY( VecCreate(PETSC_COMM_WORLD, &x_global) );
+				TRY( VecSetSizes(x_global, K*Tlocal, PETSC_DETERMINE) );
+				TRY( VecSetType(x_global, VECMPI) );
+				TRY( VecSetFromOptions(x_global) );
+				TRY( VecAssemblyBegin(x_global) );
+				TRY( VecAssemblyEnd(x_global) );
+			#endif
+
+			/* create general vector from PETSc vector */
+			x = new GeneralVector<PetscVector>(x_global);
+		
 			timer1.restart();
 
-			/* create global vector */
-			TRY( VecCreate(PETSC_COMM_WORLD, &x_global) );
-			TRY( VecSetSizes(x_global, K*T, PETSC_DETERMINE) );
-			TRY( VecSetType(x_global, VECMPI) );
-			TRY( VecSetFromOptions(x_global) );
-			TRY( VecAssemblyBegin(x_global) );
-			TRY( VecAssemblyEnd(x_global) );
-		
-			/* --- INITIALIZATION --- */
-
 			/* prepare feasible set */
-			feasibleset =  new SimplexFeasibleSet_Local(T,K);  	
-
-			#ifdef USE_CUDA
-				TRY( VecCreateSeqCUDA(PETSC_COMM_SELF, K*T, &x_local) );
-				gpuErrchk(cudaDeviceSynchronize());
-			#else
-				TRY( VecCreateSeq(PETSC_COMM_SELF, K*T, &x_local)  );
-			#endif
+			feasibleset =  new SimplexFeasibleSet_Local(Tlocal,K);
 
 			/* log */
 			std::ostringstream oss_print_to_log;

		}
	}
	coutMaster << " (number of clusters)" << std::endl;
	coutMaster << "n = " << std::setw(7) << n << " (number of tests)" << std::endl;
	coutMaster << "------------------------------------------------------------------" << std::endl;	



	TRY( PetscRandomSetFromOptions(rnd) );
	TRY( PetscRandomSetSeed(rnd,13) );

	Vec layout;
	int Tlocal;
	GeneralVector<PetscVector> *x;

	int Ti, Ki;
