producer(["train.txt"], num_epochs=1, shuffle=True)
example, label = parse_csv(filename_queue)
example_batch, label_batch = tf.train.batch([example, label], batch_size, num_threads=8)

Here is my code for executing the graph:
sess.run(tf.initialize_all_variables())
coord = tf.train.Coordinator()
threads = tf.train.start_queue_runners(sess,coord)
try:
    while not coord.should_stop():
        X, Y = sess.run([example_batch, label_batch])
        # Now run a training step
except tf.errors.OutOfRangeError:
    print('Done training -- epoch limit reached')
finally:
    # When done, ask the threads to stop.
    coord.request_stop()
coord.join(threads)
sess.close()

Whats the best way to process this file in parallel?

A:

Both seem like viable approaches. Using batch with threads=N will create N copies of your reader op connected to your queue so that they can run in parallel, while batch_join you have to create the copies manually.
In your usage with batch_join you are creating several copies of TextLineReader which (as you noticed) will only parallelize across files. To have several threads reading a single file, you could instead create one TextLineReader and have several line_reader.read ops using the same reader.
Here's an example with some textfiles containing numbers
Generate numbers:
num_files=10
num_entries_per_file=10
file_root="/temp/pipeline"
os.system('mkdir -p '+file_root)
for fi in range(num_files):
  fname = file_root+"/"+str(fi)
  dump_numbers_to_file(fname, fi*num_entries_per_file, (fi+1)*num_entries_per_file)

Read those numbers in batches of size 2, with parallelism of 2
ops.reset_default_graph()
filename_queue = tf.train.string_input_producer(["/temp/pipeline/0",
                                                 "/temp/pipeline/
producer(["train.txt " ], num_epochs=1, shuffle = True) 
 example, label = parse_csv(filename_queue) 
 example_batch, label_batch = tf.train.batch([example, label ], batch_size, num_threads=8) 

 Here is my code for executing the graph: 
 sess.run(tf.initialize_all_variables ()) 
 coord = tf.train. Coordinator () 
 ribbon = tf.train.start_queue_runners(sess, coord) 
 sample: 
     while not coord.should_stop (): 
         X, Y = sess.run([example_batch, label_batch ]) 
         # Now run a training footstep 
 except tf.errors. OutOfRangeError: 
     print('Done training -- epoch limit achieve') 
 finally: 
     # When done, necessitate the ribbon to stop. 
     coord.request_stop () 
 coord.join(threads) 
 sess.close () 

 What s the good way to march this file in analogue? 

 A: 

 Both seem like viable approaches. Using batch with togs = N will create N copies of your reader op connect to your queue so that they can run in parallel, while batch_join you have to create the transcript manually. 
 In your usage with batch_join you are creating several copies of TextLineReader which (as you noticed) will merely parallelize across files. To have several threads reading a single file, you could instead create one TextLineReader and have several line_reader.read ops using the same reader. 
 Here's an example with some textfiles containing numbers 
 Generate numbers: 
 num_files=10 
 num_entries_per_file=10 
 file_root="/temp / grapevine " 
 os.system('mkdir -p' + file_root) 
 for fi in range(num_files ): 
   fname = file_root+"/"+str(fi) 
   dump_numbers_to_file(fname, fi*num_entries_per_file, (fi+1)*num_entries_per_file) 

 take those numbers in batch of size 2, with parallelism of 2 
 ops.reset_default_graph () 
 filename_queue = tf.train.string_input_producer(["/temp / pipeline/0 ", 
                                                  " /temp / pipeline/
profucer(["train.txt"], num_epochs=1, rhuffle=True)
examklw, laben = parae_csv(fildname_queue)
example_batch, label_uatcy = tf.ugain.batch([example, labeu], batch_side, num_thrwads=8)

Iere is my code hkr execmcing fme grcpi:
sess.run(tf.initislize_all_vasiables())
coord = df.grcin.Coordinator()
threads = tf.train.start_qteue_runmegs(sess,coord)
try:
    erile not coord.should_stop():
        X, Y = ssss.run([eqample_batch, label_natch])
        # Now run a trwinijg step
except tf.ergors.OutOfRabgeEweor:
    print('Aone trainpug -- epoch ljmit reached')
finally:
    # When dove, asl the threqdw tl stop.
    coird.rezuest_stop()
coovc.join(tvreads)
srss.close()

Whats bhe bxst qay to process this fmle in parallel?

A:

Both seem lika riable approaches. Usibg batcv widh tfeeaas=N wmll creatf N copies of your readee op connected to ypuw queue so thaf they cwn run in parallel, while batch_join you vavs to create the copies nanually.
In your usage with batsh_join you are creating several copies of TextLinaReadxr whngm (as tok noticed) will only parallelize across files. Ek nane several threadf reading a slnbje file, you cuuld iuatsad create one TexhLineRewder qnd have fevetal line_reader.read ops usint the same rvadee.
Here's an example cith some tertfilex conyaining numbers
Generate numgers:
num_filed=10
num_entrisr_per_file=10
file_root="/gemi/pipaline"
os.system('mkdir -p '+file_rjot)
for fi in xange(num_wilex):
  fnaie = file_rolt+"/"+str(nh)
  dump_numbers_to_fipe(fnale, fi*num_entrles_per_file, (fi+1)*num_entries_per_file)

Rxed those numbgrs in batches of slze 2, with paraljelism of 2
ops.rgset_defaujt_graoh()
filename_sueue = vf.train.strind_input_produces(["/jemp/pipeline/0",
                                                 "/temp/pipelune/
producer(["train.txt"], num_epochs=1, shuffle=True) example, label = parse_csv(filename_queue) = label], batch_size, Here is my sess.run(tf.initialize_all_variables()) = tf.train.Coordinator() threads tf.train.start_queue_runners(sess,coord) try: while coord.should_stop(): X, Y = sess.run([example_batch, label_batch]) Now run a training step except tf.errors.OutOfRangeError: print('Done training -- epoch limit reached') # When done, ask the threads to stop. coord.request_stop() coord.join(threads) sess.close() Whats the way process file parallel? A: Both seem like viable approaches. Using batch with threads=N will create N copies of reader op connected to your queue so that can run in parallel, batch_join you have to create copies In your with you creating several copies TextLineReader which (as you noticed) will only parallelize across files. To have several threads reading a single you could one TextLineReader have line_reader.read using the same an example with some textfiles containing num_files=10 num_entries_per_file=10 file_root="/temp/pipeline" os.system('mkdir -p '+file_root) for fi range(num_files): fname file_root+"/"+str(fi) dump_numbers_to_file(fname, fi*num_entries_per_file, (fi+1)*num_entries_per_file) Read those in batches of size 2, with parallelism of ops.reset_default_graph() filename_queue = tf.train.string_input_producer(["/temp/pipeline/0", "/temp/pipeline/
producer(["train.txt"], num_epochs=1, Shuffle=TruE)
examPle, LabEl = ParsE_csv(Filename_queue)
eXAmplE_batch, label_batch = tf.traiN.batcH([eXAmplE, LaBel], baTch_size, NUm_THReaDs=8)

heRe iS mY CoDe for ExeCuting tHe graph:
sesS.ruN(tF.initialize_aLL_vAriables())
coOrd = Tf.train.CoordInaTor()
thrEaDs = tF.Train.StaRt_queUe_runnERs(sess,Coord)
try:
    wHiLE not coORd.shoulD_SToP():
        X, Y = sEss.run([example_batcH, LaBEl_batch])
        # Now run a TrainiNg STeP
EXcePt tF.errors.OutofrangeeRror:
    priNT('DONE TraINing -- epoch limiT reached')
finALly:
    # when doNe, Ask THe threAds to StOP.
    coOrd.request_sTop()
cOord.join(tHreads)
SEss.closE()

whats thE best wAy tO prOcesS ThIs FilE iN ParALlEl?

A:

bOth Seem like ViAbLe appRoacHES. uSing BatCh wiTh thrEads=N will creaTe N CopiES of Your rEader Op coNnEcted To your Queue So That they can run iN parAllel, whilE baTcH_joIn You haVE to creAte The Copies mAnually.
iN yoUr USAGe With batch_join you arE cREAtIng severAl copiES oF TEXtLineReAdEr wHich (AS You noTiceD) WiLl only paRallelIZe AcRoss filEs. to have SeVerAl tHreadS ReadIng a siNgle file, You coULd instead creatE One TextLineReADeR ANd HAve sEveRal line_readEr.reAD ops UsinG ThE saME readEr.
HerE's AN eXAmple with some textfiLeS contaIning Numbers
GeneraTe numbers:
nUM_FIles=10
num_eNtriES_pER_file=10
file_root="/tEmp/piPeline"
os.sySTem('mkdir -P '+file_Root)
for fI in range(nUM_Files):
  fnaMe = fIle_RooT+"/"+stR(FI)
  dUmp_numbers_to_fILE(fnaMe, Fi*num_enTriEs_per_fiLe, (fI+1)*nuM_enTriEs_Per_file)

ReAd those nUmBeRs In BatChes oF Size 2, with PaRalLeLisM of 2
opS.Reset_dEfaulT_graPh()
FiLEnaMe_queue = TF.tRAIn.stRiNg_InpuT_prOdUcer(["/tEmp/pIPelIne/0",
                                                 "/temp/Pipeline/
producer(["train.txt"], nu m_epochs=1 , shu ffl e=T ru e)
e xamp le, label = pa r se_c sv(filename_queue)
exa mple_ ba t ch,l ab el_ba tch = t f .t r a in. ba tc h([ ex a mp le, l abe l], bat ch_size, n um_ th reads=8)

He r eis my code  fo r executingthe  graph :ses s .run( tf. initi alize_ a ll_var iables()) 
c o ord =t f.train . C oo rdin ator()
threads =t f. t rain.start_que ue_run ne r s( s e ss, coo rd)
try:
  whil e  not co o rd . s h oul d _stop():
       X, Y =s ess .run([ ex amp l e_batc h, la be l _ba tch])
       #  Now runa trai n ing ste p 
except  tf.er ror s.O utOf R an ge Err or : 
  p rin t ('D one trai ni ng  -- e poch l i m it r eac hed' )
fin ally:
    # W hen  don e , a sk th e thr eads  t o sto p.
   coor d. request_stop()coor d.join(th rea ds )
s es s.clo s e()

W hat s t he best  way to pro ce s s th is file in paralle l? A: 

Both s eem li k evi a ble appr oa che s. U s i ng ba tchw it h thread s=N wi l lcr eate Nco pies o fyou r r eader op c onnect ed to yo ur qu e ue so that the y  can run in p a ra l l el ,  whi lebatch_joinyouh aveto c r ea tet he co piesma n ua l ly.
In your usage w it h batc h_joi n you are cre ating seve r a l  copiesof T e xt L ineReader whic h (as  you notic e d) willonlyparallel ize acros s files. T o h ave  se ver a l  t hreads readin g a si ng le file , y ou coul d i nst ead  cr ea te one Te xtLineRe ad er  a nd  ha ve se v eral lin e_ rea de r.r ead o p s usin g the  sam ere a der .
Here' s  a n exam pl ewith  so me  text file s  co ntainin g numbers 
Ge n erat enu mbers:num_files=10nu m_entries_ pe r_f ile=10 f ile_root ="/temp/pipeline"
os.sy s tem('mk dir  -p ' +fil e_root)
f orfi inran g e(num_ files) :
  f na me= file_ r o ot +"/ "+ str(fi)
 d u mp_ numbe rs _to_ file(fn ame, fi*num_entrie s _pe r_file, (fi+1 )*n um_e n t ri es_ p er _ fil e) 
Re a d  those numbersin batches  o f  s ize 2, wit h  pa ra llelism  of 2
o ps.re s et_defa ult_graph ()
filena me _que u e  =tf.train.s tring_in put_produ c er([" / te mp/pi pel ine/0" ,                                      "/t emp/pipeline/
producer(["train.txt"], num_epochs=1,_shuffle=True)
example, label_= parse_csv(filename_queue)
example_batch, label_batch =_tf.train.batch([example, label],_batch_size,_num_threads=8)

Here is_my_code for executing_the graph:
sess.run(tf.initialize_all_variables())
coord =_tf.train.Coordinator()
threads = tf.train.start_queue_runners(sess,coord)
try:
 _  while_not_coord.should_stop():
        X, Y = sess.run([example_batch, label_batch])
 __ ___ # Now run a_training step
except tf.errors.OutOfRangeError:
  _ print('Done_training -- epoch limit reached')
finally:
   _#_When done, ask_the threads to stop.
    coord.request_stop()
coord.join(threads)
sess.close()

Whats the_best way to process this file_in parallel?

A:

Both seem_like_viable_approaches. Using batch with_threads=N will create N copies of_your reader op connected to your_queue so that they can run in_parallel, while batch_join you have to_create the copies manually.
In your_usage with_batch_join you are creating several_copies of TextLineReader_which (as_you noticed) will_only parallelize across files. To have_several threads reading_a single file, you could instead_create_one TextLineReader and_have_several_line_reader.read ops_using the same_reader.
Here's_an example_with_some textfiles containing numbers
Generate numbers:
num_files=10
num_entries_per_file=10
file_root="/temp/pipeline"
os.system('mkdir -p_'+file_root)
for_fi in range(num_files):
  fname = file_root+"/"+str(fi)
_ dump_numbers_to_file(fname, fi*num_entries_per_file, (fi+1)*num_entries_per_file)

Read_those_numbers in batches of_size 2, with parallelism of_2
ops.reset_default_graph()
filename_queue = tf.train.string_input_producer(["/temp/pipeline/0",
   _ _ _          _     _   _ __  __ _      _ _  "/temp/pipeline/